package org.hl7.fhir.r5.formats;

import java.io.IOException;

import org.hl7.fhir.exceptions.FHIRFormatError;

// generated



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

// Generated on Mon, May 11, 2020 09:58+1000 for FHIR vcurrent



import org.hl7.fhir.r5.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(boolean allowUnknownContent) {
    super();
    setAllowUnknownContent(allowUnknownContent);
  }

  protected boolean parseBaseContent(int eventType, XmlPullParser xpp, Base res) throws XmlPullParserException, IOException, FHIRFormatError {
    return false;
  }

  @SuppressWarnings("unchecked")
  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(XmlPullParser xpp, E item, EnumFactory e) throws XmlPullParserException, IOException, FHIRFormatError {
    Enumeration<E> res = new Enumeration<E>(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 Integer64Type parseInteger64(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Integer64Type res = new Integer64Type(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 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 if (!parseElementContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

  protected boolean parseBackboneTypeContent(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 if (!parseDataTypeContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

  protected boolean parseDataTypeContent(int eventType, XmlPullParser xpp, DataType res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (!parseElementContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

  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 if (!parseBaseContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

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

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

  protected Age parseAge(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Age res = new Age();
    parseElementAttributes(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 Annotation parseAnnotation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Annotation res = new Annotation();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Attachment parseAttachment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Attachment res = new Attachment();
    parseElementAttributes(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(parseInteger64(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 (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("pages")) {
      res.setPagesElement(parsePositiveInt(xpp));
    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected CodeableConcept parseCodeableConcept(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeableConcept res = new CodeableConcept();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCodeableReferenceContent(int eventType, XmlPullParser xpp, CodeableReference res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
      res.setConcept(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.setReference(parseReference(xpp));
    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Coding parseCoding(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Coding res = new Coding();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

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

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

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

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

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

  protected Count parseCount(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Count res = new Count();
    parseElementAttributes(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();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDataRequirementContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementContent(int eventType, XmlPullParser xpp, DataRequirement res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
    } 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(parseDataRequirementCodeFilterComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateFilter")) {
      res.getDateFilter().add(parseDataRequirementDateFilterComponent(xpp));
    } 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(parseDataRequirementSortComponent(xpp));
    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementCodeFilterComponent(XmlPullParser xpp) 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 (!parseDataRequirementCodeFilterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementCodeFilterComponentContent(int eventType, XmlPullParser xpp, 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 parseDataRequirementDateFilterComponent(XmlPullParser xpp) 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 (!parseDataRequirementDateFilterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementDateFilterComponentContent(int eventType, XmlPullParser xpp, 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 parseDataRequirementSortComponent(XmlPullParser xpp) 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 (!parseDataRequirementSortComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDataRequirementSortComponentContent(int eventType, XmlPullParser xpp, 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 Distance parseDistance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Distance res = new Distance();
    parseElementAttributes(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 Dosage parseDosage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Dosage res = new Dosage();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDosageContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

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

  protected Dosage.DosageDoseAndRateComponent parseDosageDoseAndRateComponent(XmlPullParser xpp) 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 (!parseDosageDoseAndRateComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDosageDoseAndRateComponentContent(int eventType, XmlPullParser xpp, 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 Duration parseDuration(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Duration res = new Duration();
    parseElementAttributes(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 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(parseElementDefinitionSlicingComponent(xpp));
    } 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(parseElementDefinitionBaseComponent(xpp));
    } 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));
    } 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(parseElementDefinitionExampleComponent(xpp));
    } 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(parseElementDefinitionConstraintComponent(xpp));
    } 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(parseElementDefinitionBindingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mapping")) {
      res.getMapping().add(parseElementDefinitionMappingComponent(xpp));
    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionSlicingComponent(XmlPullParser xpp) 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 (!parseElementDefinitionSlicingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionSlicingComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionSlicingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("discriminator")) {
      res.getDiscriminator().add(parseElementDefinitionSlicingDiscriminatorComponent(xpp));
    } 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 parseElementDefinitionSlicingDiscriminatorComponent(XmlPullParser xpp) 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 (!parseElementDefinitionSlicingDiscriminatorComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionSlicingDiscriminatorComponentContent(int eventType, XmlPullParser xpp, 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 parseElementDefinitionBaseComponent(XmlPullParser xpp) 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 (!parseElementDefinitionBaseComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionBaseComponentContent(int eventType, XmlPullParser xpp, 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) 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, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionTypeRefComponentContent(int eventType, XmlPullParser xpp, 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 parseElementDefinitionExampleComponent(XmlPullParser xpp) 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 (!parseElementDefinitionExampleComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionExampleComponentContent(int eventType, XmlPullParser xpp, 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 parseElementDefinitionConstraintComponent(XmlPullParser xpp) 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 (!parseElementDefinitionConstraintComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionConstraintComponentContent(int eventType, XmlPullParser xpp, 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 parseElementDefinitionBindingComponent(XmlPullParser xpp) 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 (!parseElementDefinitionBindingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionBindingComponentContent(int eventType, XmlPullParser xpp, 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 parseElementDefinitionMappingComponent(XmlPullParser xpp) 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 (!parseElementDefinitionMappingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseElementDefinitionMappingComponentContent(int eventType, XmlPullParser xpp, 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 Expression parseExpression(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Expression res = new Expression();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

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

  protected Identifier parseIdentifier(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Identifier res = new Identifier();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected MarketingStatus parseMarketingStatus(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MarketingStatus res = new MarketingStatus();
    parseElementAttributes(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 (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMetaContent(int eventType, XmlPullParser xpp, Meta res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versionId")) {
      res.setVersionIdElement(parseId(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastUpdated")) {
      res.setLastUpdatedElement(parseInstant(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Money parseMoney(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Money res = new Money();
    parseElementAttributes(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 (!parseDataTypeContent(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseOrderedDistributionContent(int eventType, XmlPullParser xpp, OrderedDistribution 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("note")) {
      res.getNote().add(parseAnnotation(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numberOfIntervals")) {
      res.setNumberOfIntervalsElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bottomOfFirstInterval")) {
      res.setBottomOfFirstInterval(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interval")) {
      res.getInterval().add(parseOrderedDistributionIntervalComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topOfInterval")) {
      res.setTopOfInterval(parseQuantity(xpp));
    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseOrderedDistributionIntervalComponentContent(int eventType, XmlPullParser xpp, OrderedDistribution.OrderedDistributionIntervalComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rankOrder")) {
      res.setRankOrderElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intervalStatistic")) {
      res.getIntervalStatistic().add(parseStatistic(xpp));
    } else if (!parseElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseParameterDefinitionContent(int eventType, XmlPullParser xpp, ParameterDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
      res.setNameElement(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
      res.setUseElement(parseEnumeration(xpp, Enumerations.OperationParameterUse.NULL, new Enumerations.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(parseEnumeration(xpp, Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
      res.setProfileElement(parseCanonical(xpp));
    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Period parsePeriod(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Period res = new Period();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Population parsePopulation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Population res = new Population();
    parseElementAttributes(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 (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ProdCharacteristic parseProdCharacteristic(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ProdCharacteristic res = new ProdCharacteristic();
    parseElementAttributes(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 (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ProductShelfLife parseProductShelfLife(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ProductShelfLife res = new ProductShelfLife();
    parseElementAttributes(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 (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Quantity parseQuantity(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Quantity res = new Quantity();
    parseElementAttributes(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, Enumerations.QuantityComparator.NULL, new Enumerations.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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Range parseRange(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Range res = new Range();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Ratio parseRatio(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Ratio res = new Ratio();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Reference parseReference(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Reference res = new Reference();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseRelatedArtifactContent(int eventType, XmlPullParser xpp, RelatedArtifact res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected SampledData parseSampledData(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SampledData res = new SampledData();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Signature parseSignature(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Signature res = new Signature();
    parseElementAttributes(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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStatisticContent(int eventType, XmlPullParser xpp, Statistic 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("note")) {
      res.getNote().add(parseAnnotation(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statisticType")) {
      res.setStatisticType(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("sampleSize")) {
      res.setSampleSize(parseStatisticSampleSizeComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attributeEstimate")) {
      res.getAttributeEstimate().add(parseStatisticAttributeEstimateComponent(xpp));
    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStatisticSampleSizeComponentContent(int eventType, XmlPullParser xpp, Statistic.StatisticSampleSizeComponent 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("note")) {
      res.getNote().add(parseAnnotation(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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("knownDataCount")) {
      res.setKnownDataCountElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numeratorCount")) {
      res.setNumeratorCountElement(parseInteger(xpp));
    } else if (!parseElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStatisticAttributeEstimateComponentContent(int eventType, XmlPullParser xpp, Statistic.StatisticAttributeEstimateComponent 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("note")) {
      res.getNote().add(parseAnnotation(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("level")) {
      res.setLevelElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("range")) {
      res.setRange(parseRange(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("estimateQualifier")) {
      res.getEstimateQualifier().add(parseStatisticAttributeEstimateEstimateQualifierComponent(xpp));
    } else if (!parseElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStatisticAttributeEstimateEstimateQualifierComponentContent(int eventType, XmlPullParser xpp, Statistic.StatisticAttributeEstimateEstimateQualifierComponent 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("note")) {
      res.getNote().add(parseAnnotation(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("level")) {
      res.setLevelElement(parseDecimal(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("range")) {
      res.setRange(parseRange(xpp));
    } else if (!parseElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected SubstanceAmount parseSubstanceAmount(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceAmount res = new SubstanceAmount();
    parseElementAttributes(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(parseSubstanceAmountReferenceRangeComponent(xpp));
    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountReferenceRangeComponent(XmlPullParser xpp) 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 (!parseSubstanceAmountReferenceRangeComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceAmountReferenceRangeComponentContent(int eventType, XmlPullParser xpp, 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 Timing parseTiming(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Timing res = new Timing();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTimingContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

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

  protected Timing.TimingRepeatComponent parseTimingRepeatComponent(XmlPullParser xpp) 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 (!parseTimingRepeatComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTimingRepeatComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
    } 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 TriggerDefinition parseTriggerDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TriggerDefinition res = new TriggerDefinition();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTriggerDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTriggerDefinitionContent(int eventType, XmlPullParser xpp, TriggerDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("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 (!parseDataTypeContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

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

  protected boolean parseCanonicalResourceContent(int eventType, XmlPullParser xpp, CanonicalResource res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (!parseDomainResourceContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

  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 if (!parseResourceContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

  protected boolean parseMetadataResourceContent(int eventType, XmlPullParser xpp, MetadataResource res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

  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 if (!parseBaseContent(eventType, xpp, res)){ 
        return false;
    }
    return true;
  }

  protected Account parseAccount(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Account res = new Account();
    parseResourceAttributes(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));
    } 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));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Account.CoverageComponent res = new Account.CoverageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAccountCoverageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAccountCoverageComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Account.GuarantorComponent res = new Account.GuarantorComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAccountGuarantorComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAccountGuarantorComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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.RequestResourceType.NULL, new ActivityDefinition.RequestResourceTypeEnumFactory()));
    } 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, Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
      res.setPriorityElement(parseEnumeration(xpp, Enumerations.RequestPriority.NULL, new Enumerations.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(parseActivityDefinitionParticipantComponent(xpp));
    } 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(parseActivityDefinitionDynamicValueComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseActivityDefinitionParticipantComponentContent(int eventType, XmlPullParser xpp, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, Enumerations.ActionParticipantType.NULL, new Enumerations.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 ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionDynamicValueComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseActivityDefinitionDynamicValueComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseActivityDefinitionDynamicValueComponentContent(int eventType, XmlPullParser xpp, 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 AdministrableProductDefinition parseAdministrableProductDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdministrableProductDefinition res = new AdministrableProductDefinition();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAdministrableProductDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdministrableProductDefinitionContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition 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("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("producedFrom")) {
      res.getProducedFrom().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("device")) {
      res.getDevice().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseAdministrableProductDefinitionPropertyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("routeOfAdministration")) {
      res.getRouteOfAdministration().add(parseAdministrableProductDefinitionRouteOfAdministrationComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAdministrableProductDefinitionPropertyComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent 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("status")) {
      res.setStatus(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAdministrableProductDefinitionRouteOfAdministrationComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent 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(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent 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(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent 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 AdverseEvent parseAdverseEvent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent res = new AdverseEvent();
    parseResourceAttributes(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.getIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, AdverseEvent.AdverseEventStatus.NULL, new AdverseEvent.AdverseEventStatusEnumFactory()));
    } 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("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("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("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("participant")) {
      res.getParticipant().add(parseAdverseEventParticipantComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suspectEntity")) {
      res.getSuspectEntity().add(parseAdverseEventSuspectEntityComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributingFactor")) {
      res.getContributingFactor().add(parseAdverseEventContributingFactorComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preventiveAction")) {
      res.getPreventiveAction().add(parseAdverseEventPreventiveActionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mitigatingAction")) {
      res.getMitigatingAction().add(parseAdverseEventMitigatingActionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
      res.getSupportingInfo().add(parseAdverseEventSupportingInfoComponent(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.AdverseEventParticipantComponent parseAdverseEventParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent.AdverseEventParticipantComponent res = new AdverseEvent.AdverseEventParticipantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAdverseEventParticipantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventParticipantComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventParticipantComponent 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 AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventSuspectEntityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAdverseEventSuspectEntityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventSuspectEntityComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventSuspectEntityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "instance")) {
      res.setInstance(parseType("instance", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causality")) {
      res.setCausality(parseAdverseEventSuspectEntityCausalityComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAdverseEventSuspectEntityCausalityComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assessmentMethod")) {
      res.setAssessmentMethod(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entityRelatedness")) {
      res.setEntityRelatedness(parseCodeableConcept(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 AdverseEvent.AdverseEventContributingFactorComponent parseAdverseEventContributingFactorComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent.AdverseEventContributingFactorComponent res = new AdverseEvent.AdverseEventContributingFactorComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAdverseEventContributingFactorComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventContributingFactorComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventContributingFactorComponent 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 AdverseEvent.AdverseEventPreventiveActionComponent parseAdverseEventPreventiveActionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent.AdverseEventPreventiveActionComponent res = new AdverseEvent.AdverseEventPreventiveActionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAdverseEventPreventiveActionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventPreventiveActionComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventPreventiveActionComponent 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 AdverseEvent.AdverseEventMitigatingActionComponent parseAdverseEventMitigatingActionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent.AdverseEventMitigatingActionComponent res = new AdverseEvent.AdverseEventMitigatingActionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAdverseEventMitigatingActionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventMitigatingActionComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventMitigatingActionComponent 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 AdverseEvent.AdverseEventSupportingInfoComponent parseAdverseEventSupportingInfoComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AdverseEvent.AdverseEventSupportingInfoComponent res = new AdverseEvent.AdverseEventSupportingInfoComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAdverseEventSupportingInfoComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAdverseEventSupportingInfoComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventSupportingInfoComponent 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 AllergyIntolerance parseAllergyIntolerance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AllergyIntolerance res = new AllergyIntolerance();
    parseResourceAttributes(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(parseAllergyIntoleranceReactionComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAllergyIntoleranceReactionComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("reason")) {
      res.getReason().add(parseCodeableReference(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(parseAppointmentParticipantComponent(xpp));
    } 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 parseAppointmentParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAppointmentParticipantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAppointmentParticipantComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.ParticipationStatus.NULL, new Enumerations.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();
    parseResourceAttributes(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, Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
    } 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();
    parseResourceAttributes(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("severity")) {
      res.setSeverityElement(parseEnumeration(xpp, AuditEvent.AuditEventSeverity.NULL, new AuditEvent.AuditEventSeverityEnumFactory()));
    } 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.setOutcome(parseCodeableConcept(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(parseAuditEventAgentComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.setSource(parseAuditEventSourceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entity")) {
      res.getEntity().add(parseAuditEventEntityComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAuditEventAgentComponentContent(int eventType, XmlPullParser xpp, 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(parseAuditEventAgentNetworkComponent(xpp));
    } 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 parseAuditEventAgentNetworkComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAuditEventAgentNetworkComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventAgentNetworkComponentContent(int eventType, XmlPullParser xpp, 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 parseAuditEventSourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAuditEventSourceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventSourceComponentContent(int eventType, XmlPullParser xpp, 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 parseAuditEventEntityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseAuditEventEntityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseAuditEventEntityComponentContent(int eventType, XmlPullParser xpp, 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("query")) {
      res.setQueryElement(parseBase64Binary(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
      res.getDetail().add(parseAuditEventEntityDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseAuditEventEntityDetailComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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();
    parseResourceAttributes(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(parseBiologicallyDerivedProductCollectionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processing")) {
      res.getProcessing().add(parseBiologicallyDerivedProductProcessingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manipulation")) {
      res.setManipulation(parseBiologicallyDerivedProductManipulationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("storage")) {
      res.getStorage().add(parseBiologicallyDerivedProductStorageComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseBiologicallyDerivedProductCollectionComponentContent(int eventType, XmlPullParser xpp, 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 parseBiologicallyDerivedProductProcessingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseBiologicallyDerivedProductProcessingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBiologicallyDerivedProductProcessingComponentContent(int eventType, XmlPullParser xpp, 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 parseBiologicallyDerivedProductManipulationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseBiologicallyDerivedProductManipulationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBiologicallyDerivedProductManipulationComponentContent(int eventType, XmlPullParser xpp, 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 parseBiologicallyDerivedProductStorageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseBiologicallyDerivedProductStorageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBiologicallyDerivedProductStorageComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseBundleLinkComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entry")) {
      res.getEntry().add(parseBundleEntryComponent(xpp));
    } 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 parseBundleLinkComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseBundleLinkComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleLinkComponentContent(int eventType, XmlPullParser xpp, 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 parseBundleEntryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseBundleEntryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleEntryComponentContent(int eventType, XmlPullParser xpp, Bundle.BundleEntryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
      res.getLink().add(parseBundleLinkComponent(xpp));
    } 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(parseBundleEntrySearchComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
      res.setRequest(parseBundleEntryRequestComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
      res.setResponse(parseBundleEntryResponseComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseBundleEntrySearchComponentContent(int eventType, XmlPullParser xpp, 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 parseBundleEntryRequestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseBundleEntryRequestComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleEntryRequestComponentContent(int eventType, XmlPullParser xpp, 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 parseBundleEntryResponseComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseBundleEntryResponseComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseBundleEntryResponseComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.CapabilityStatementKind.NULL, new Enumerations.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(parseCapabilityStatementSoftwareComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementation")) {
      res.setImplementation(parseCapabilityStatementImplementationComponent(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("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(parseCapabilityStatementRestComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("messaging")) {
      res.getMessaging().add(parseCapabilityStatementMessagingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("document")) {
      res.getDocument().add(parseCapabilityStatementDocumentComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCapabilityStatementSoftwareComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementImplementationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementImplementationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementImplementationComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementRestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementRestComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementRestComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementRestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
      res.setModeElement(parseEnumeration(xpp, Enumerations.RestfulCapabilityMode.NULL, new Enumerations.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(parseCapabilityStatementRestSecurityComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
      res.getResource().add(parseCapabilityStatementRestResourceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
      res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
      res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(xpp));
    } 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 parseCapabilityStatementRestSecurityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementRestSecurityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementRestSecurityComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementRestResourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementRestResourceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementRestResourceComponentContent(int eventType, XmlPullParser xpp, 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));
    } 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(parseCapabilityStatementRestResourceSearchParamComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCapabilityStatementResourceInteractionComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementRestResourceSearchParamComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementRestResourceSearchParamComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementRestResourceSearchParamComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementRestResourceOperationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementRestResourceOperationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementRestResourceOperationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementSystemInteractionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementSystemInteractionComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementMessagingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementMessagingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementMessagingComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementMessagingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
      res.getEndpoint().add(parseCapabilityStatementMessagingEndpointComponent(xpp));
    } 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(parseCapabilityStatementMessagingSupportedMessageComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCapabilityStatementMessagingEndpointComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementMessagingSupportedMessageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementMessagingSupportedMessageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementMessagingSupportedMessageComponentContent(int eventType, XmlPullParser xpp, 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 parseCapabilityStatementDocumentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatementDocumentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatementDocumentComponentContent(int eventType, XmlPullParser xpp, 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 CapabilityStatement2 parseCapabilityStatement2(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement2 res = new CapabilityStatement2();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatement2Content(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatement2Content(int eventType, XmlPullParser xpp, CapabilityStatement2 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, Enumerations.CapabilityStatementKind.NULL, new Enumerations.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(parseCapabilityStatement2SoftwareComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementation")) {
      res.setImplementation(parseCapabilityStatement2ImplementationComponent(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("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(parseCapabilityStatement2RestComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCapabilityStatement2SoftwareComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.CapabilityStatement2SoftwareComponent 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 CapabilityStatement2.CapabilityStatement2ImplementationComponent parseCapabilityStatement2ImplementationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement2.CapabilityStatement2ImplementationComponent res = new CapabilityStatement2.CapabilityStatement2ImplementationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatement2ImplementationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatement2ImplementationComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.CapabilityStatement2ImplementationComponent 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 CapabilityStatement2.CapabilityStatement2RestComponent parseCapabilityStatement2RestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement2.CapabilityStatement2RestComponent res = new CapabilityStatement2.CapabilityStatement2RestComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatement2RestComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatement2RestComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.CapabilityStatement2RestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
      res.setModeElement(parseEnumeration(xpp, Enumerations.RestfulCapabilityMode.NULL, new Enumerations.RestfulCapabilityModeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
      res.setDocumentationElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
      res.getResource().add(parseCapabilityStatement2RestResourceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
      res.getInteraction().add(parseCapabilityStatement2SystemInteractionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
      res.getSearchParam().add(parseCapabilityStatement2RestResourceSearchParamComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.getOperation().add(parseCapabilityStatement2RestResourceOperationComponent(xpp));
    } 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 CapabilityStatement2.CapabilityStatement2RestResourceComponent parseCapabilityStatement2RestResourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement2.CapabilityStatement2RestResourceComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatement2RestResourceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatement2RestResourceComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.CapabilityStatement2RestResourceComponent 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(parseCapabilityStatement2ResourceInteractionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
      res.getSearchParam().add(parseCapabilityStatement2RestResourceSearchParamComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.getOperation().add(parseCapabilityStatement2RestResourceOperationComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCapabilityStatement2ResourceInteractionComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.ResourceInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCodeElement(parseEnumeration(xpp, CapabilityStatement2.TypeRestfulInteraction.NULL, new CapabilityStatement2.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 CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent parseCapabilityStatement2RestResourceSearchParamComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatement2RestResourceSearchParamComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatement2RestResourceSearchParamComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent 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 CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent parseCapabilityStatement2RestResourceOperationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent res = new CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatement2RestResourceOperationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatement2RestResourceOperationComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent 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 CapabilityStatement2.SystemInteractionComponent parseCapabilityStatement2SystemInteractionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CapabilityStatement2.SystemInteractionComponent res = new CapabilityStatement2.SystemInteractionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCapabilityStatement2SystemInteractionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCapabilityStatement2SystemInteractionComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement2.SystemInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCodeElement(parseEnumeration(xpp, CapabilityStatement2.SystemRestfulInteraction.NULL, new CapabilityStatement2.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 CarePlan parseCarePlan(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CarePlan res = new CarePlan();
    parseResourceAttributes(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, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
    } 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(parseCodeableReference(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(parseCarePlanActivityComponent(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 CarePlan.CarePlanActivityComponent parseCarePlanActivityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCarePlanActivityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCarePlanActivityComponentContent(int eventType, XmlPullParser xpp, CarePlan.CarePlanActivityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
      res.getOutcome().add(parseCodeableReference(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(parseCarePlanActivityDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCarePlanActivityDetailComponentContent(int eventType, XmlPullParser xpp, 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("reason")) {
      res.getReason().add(parseCodeableReference(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(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reported")) {
      res.setReported(parseType("reported", 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();
    parseResourceAttributes(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("period")) {
      res.setPeriod(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
      res.getParticipant().add(parseCareTeamParticipantComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
      res.getReason().add(parseCodeableReference(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 parseCareTeamParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCareTeamParticipantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCareTeamParticipantComponentContent(int eventType, XmlPullParser xpp, CareTeam.CareTeamParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
      res.setRole(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("member")) {
      res.setMember(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
      res.setOnBehalfOf(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "coverage")) {
      res.setCoverage(parseType("coverage", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected CatalogEntry parseCatalogEntry(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CatalogEntry res = new CatalogEntry();
    parseResourceAttributes(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("name")) {
      res.setNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, CatalogEntry.CatalogEntryType.NULL, new CatalogEntry.CatalogEntryTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, CatalogEntry.CatalogEntryStatus.NULL, new CatalogEntry.CatalogEntryStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
      res.setEffectivePeriod(parsePeriod(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("relatedEntry")) {
      res.getRelatedEntry().add(parseCatalogEntryRelatedEntryComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("updatedBy")) {
      res.setUpdatedBy(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("estimatedDuration")) {
      res.setEstimatedDuration(parseDuration(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("billingCode")) {
      res.getBillingCode().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("billingSummary")) {
      res.setBillingSummaryElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scheduleSummary")) {
      res.setScheduleSummaryElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("limitationSummary")) {
      res.setLimitationSummaryElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("regulatorySummary")) {
      res.setRegulatorySummaryElement(parseString(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCatalogEntryRelatedEntryComponentContent(int eventType, XmlPullParser xpp, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
      res.setRelationshipElement(parseEnumeration(xpp, CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
    } 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 ChargeItem parseChargeItem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItem res = new ChargeItem();
    parseResourceAttributes(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(parseChargeItemPerformerComponent(xpp));
    } 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 parseChargeItemPerformerComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseChargeItemPerformerComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseChargeItemPerformerComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseChargeItemDefinitionApplicabilityComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("propertyGroup")) {
      res.getPropertyGroup().add(parseChargeItemDefinitionPropertyGroupComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseChargeItemDefinitionApplicabilityComponentContent(int eventType, XmlPullParser xpp, 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 parseChargeItemDefinitionPropertyGroupComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseChargeItemDefinitionPropertyGroupComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

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

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

  protected boolean parseChargeItemDefinitionPropertyGroupPriceComponentComponentContent(int eventType, XmlPullParser xpp, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, Enumerations.InvoicePriceComponentType.NULL, new Enumerations.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 Citation parseCitation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Citation res = new Citation();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCitationContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCitationContent(int eventType, XmlPullParser xpp, Citation 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("status")) {
      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
      res.getUseContext().add(parseUsageContext(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("relatedIdentifier")) {
      res.getRelatedIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateCited")) {
      res.setDateCitedElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variantCitation")) {
      res.setVariantCitation(parseCitationVariantCitationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publishingModel")) {
      res.setPublishingModel(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("journal")) {
      res.setJournal(parseCitationJournalComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("articleTitle")) {
      res.setArticleTitleElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alternativeTitle")) {
      res.getAlternativeTitle().add(parseCitationAlternativeTitleComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pagination")) {
      res.setPagination(parseCitationPaginationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("articleUrl")) {
      res.getArticleUrl().add(parseCitationArticleUrlComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abstract")) {
      res.setAbstractElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abstractCopyright")) {
      res.setAbstractCopyrightElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alternativeAbstract")) {
      res.getAlternativeAbstract().add(parseCitationAlternativeAbstractComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorList")) {
      res.setAuthorList(parseCitationAuthorListComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorString")) {
      res.getAuthorString().add(parseCitationAuthorStringComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributorList")) {
      res.setContributorList(parseCitationContributorListComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("articleLanguage")) {
      res.setArticleLanguage(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alternativeForm")) {
      res.getAlternativeForm().add(parseCitationAlternativeFormComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classifier")) {
      res.getClassifier().add(parseCodeableConcept(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("note")) {
      res.getNote().add(parseAnnotation(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medlinePubMed")) {
      res.setMedlinePubMed(parseCitationMedlinePubMedComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationVariantCitationComponentContent(int eventType, XmlPullParser xpp, Citation.CitationVariantCitationComponent 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("baseCitation")) {
      res.setBaseCitation(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationJournalComponentContent(int eventType, XmlPullParser xpp, Citation.CitationJournalComponent 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.setCountryElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("journalIssue")) {
      res.setJournalIssue(parseCitationJournalJournalIssueComponent(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 Citation.CitationJournalJournalIssueComponent parseCitationJournalJournalIssueComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Citation.CitationJournalJournalIssueComponent res = new Citation.CitationJournalJournalIssueComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCitationJournalJournalIssueComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCitationJournalJournalIssueComponentContent(int eventType, XmlPullParser xpp, Citation.CitationJournalJournalIssueComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citedMedium")) {
      res.setCitedMedium(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("volume")) {
      res.setVolumeElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issue")) {
      res.setIssueElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDate")) {
      res.setPublicationDateElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAlternativeTitleComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAlternativeTitleComponent 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("language")) {
      res.setLanguage(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
      res.setTitleElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationPaginationComponentContent(int eventType, XmlPullParser xpp, Citation.CitationPaginationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pageString")) {
      res.setPageStringElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("firstPage")) {
      res.setFirstPageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastPage")) {
      res.setLastPageElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationArticleUrlComponentContent(int eventType, XmlPullParser xpp, Citation.CitationArticleUrlComponent 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("url")) {
      res.setUrlElement(parseUri(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAlternativeAbstractComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAlternativeAbstractComponent 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("language")) {
      res.setLanguage(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abstract")) {
      res.setAbstractElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abstractCopyright")) {
      res.setAbstractCopyrightElement(parseMarkdown(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAuthorListComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAuthorListComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("complete")) {
      res.setCompleteElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      res.getAuthor().add(parseCitationAuthorListAuthorComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAuthorListAuthorComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAuthorListAuthorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastName")) {
      res.setLastNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("foreName")) {
      res.setForeNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suffix")) {
      res.setSuffixElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("initials")) {
      res.setInitialsElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collectiveName")) {
      res.setCollectiveNameElement(parseString(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("affiliationInfo")) {
      res.getAffiliationInfo().add(parseCitationAuthorListAuthorAffiliationInfoComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
      res.getAddress().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("correspondingAuthor")) {
      res.setCorrespondingAuthorElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("listOrder")) {
      res.setListOrderElement(parsePositiveInt(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAuthorListAuthorAffiliationInfoComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAuthorListAuthorAffiliationInfoComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("affiliation")) {
      res.setAffiliationElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
      res.setRoleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
      res.getIdentifier().add(parseIdentifier(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAuthorStringComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAuthorStringComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
      res.setSource(parseCodeableConcept(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 Citation.CitationContributorListComponent parseCitationContributorListComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Citation.CitationContributorListComponent res = new Citation.CitationContributorListComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCitationContributorListComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCitationContributorListComponentContent(int eventType, XmlPullParser xpp, Citation.CitationContributorListComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("complete")) {
      res.setCompleteElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
      res.getContributor().add(parseCitationContributorListContributorComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationContributorListContributorComponentContent(int eventType, XmlPullParser xpp, Citation.CitationContributorListContributorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastName")) {
      res.setLastNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("foreName")) {
      res.setForeNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suffix")) {
      res.setSuffixElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("initials")) {
      res.setInitialsElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collectiveName")) {
      res.setCollectiveNameElement(parseString(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("contribution")) {
      res.getContribution().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("affiliationInfo")) {
      res.getAffiliationInfo().add(parseCitationContributorListContributorAffiliationInfoComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("listOrder")) {
      res.setListOrderElement(parsePositiveInt(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationContributorListContributorAffiliationInfoComponentContent(int eventType, XmlPullParser xpp, Citation.CitationContributorListContributorAffiliationInfoComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("affiliation")) {
      res.setAffiliationElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
      res.setRoleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
      res.getIdentifier().add(parseIdentifier(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAlternativeFormComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAlternativeFormComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publishingModel")) {
      res.setPublishingModel(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
      res.setLanguage(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("journalIssue")) {
      res.setJournalIssue(parseCitationAlternativeFormJournalIssueComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pagination")) {
      res.setPagination(parseCitationAlternativeFormPaginationComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAlternativeFormJournalIssueComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAlternativeFormJournalIssueComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citedMedium")) {
      res.setCitedMedium(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("volume")) {
      res.setVolumeElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issue")) {
      res.setIssueElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDate")) {
      res.setPublicationDateElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationAlternativeFormPaginationComponentContent(int eventType, XmlPullParser xpp, Citation.CitationAlternativeFormPaginationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pageString")) {
      res.setPageStringElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("firstPage")) {
      res.setFirstPageElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastPage")) {
      res.setLastPageElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationMedlinePubMedComponentContent(int eventType, XmlPullParser xpp, Citation.CitationMedlinePubMedComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medlineState")) {
      res.setMedlineState(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("owner")) {
      res.setOwner(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pmid")) {
      res.setPmidElement(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pmidVersion")) {
      res.setPmidVersionElement(parsePositiveInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateCreated")) {
      res.setDateCreatedElement(parseDate(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateCompleted")) {
      res.setDateCompletedElement(parseDate(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateRevised")) {
      res.setDateRevisedElement(parseDate(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pubMedPubDate")) {
      res.getPubMedPubDate().add(parseCitationMedlinePubMedPubMedPubDateComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationState")) {
      res.setPublicationState(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArticle")) {
      res.getRelatedArticle().add(parseCitationMedlinePubMedRelatedArticleComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCitationMedlinePubMedPubMedPubDateComponentContent(int eventType, XmlPullParser xpp, Citation.CitationMedlinePubMedPubMedPubDateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationState")) {
      res.setPublicationState(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 Citation.CitationMedlinePubMedRelatedArticleComponent parseCitationMedlinePubMedRelatedArticleComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Citation.CitationMedlinePubMedRelatedArticleComponent res = new Citation.CitationMedlinePubMedRelatedArticleComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCitationMedlinePubMedRelatedArticleComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCitationMedlinePubMedRelatedArticleComponentContent(int eventType, XmlPullParser xpp, Citation.CitationMedlinePubMedRelatedArticleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citationReference")) {
      res.setCitationReference(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citationMarkdown")) {
      res.setCitationMarkdownElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
      res.getIdentifier().add(parseIdentifier(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Claim parseClaim(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim res = new Claim();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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, Enumerations.Use.NULL, new Enumerations.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));
    } 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));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
      res.getSupportingInfo().add(parseClaimSupportingInformationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
      res.getDiagnosis().add(parseClaimDiagnosisComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
      res.getProcedure().add(parseClaimProcedureComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
      res.getInsurance().add(parseClaimInsuranceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accident")) {
      res.setAccident(parseClaimAccidentComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseClaimItemComponent(xpp));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimRelatedClaimComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimRelatedClaimComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.PayeeComponent res = new Claim.PayeeComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimPayeeComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimPayeeComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimCareTeamComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimCareTeamComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimSupportingInformationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimSupportingInformationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimDiagnosisComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimDiagnosisComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimProcedureComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimProcedureComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimInsuranceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimInsuranceComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.AccidentComponent res = new Claim.AccidentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimAccidentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimAccidentComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Claim.ItemComponent res = new Claim.ItemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimItemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimItemComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimSubDetailComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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, Enumerations.Use.NULL, new Enumerations.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, Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addItem")) {
      res.getAddItem().add(parseClaimResponseAddedItemComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
      res.getTotal().add(parseClaimResponseTotalComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
      res.setPayment(parseClaimResponsePaymentComponent(xpp));
    } 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));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
      res.getError().add(parseClaimResponseErrorComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimResponseItemComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
      res.getDetail().add(parseClaimResponseItemDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimResponseAdjudicationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimResponseItemDetailComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseItemDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
      res.getSubDetail().add(parseClaimResponseSubDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimResponseSubDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimResponseAddedItemComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
      res.getDetail().add(parseClaimResponseAddedItemDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimResponseAddedItemDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
      res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimResponseAddedItemSubDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClaimResponseTotalComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimResponsePaymentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponsePaymentComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimResponseNoteComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseNoteComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimResponseInsuranceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseInsuranceComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClaimResponseErrorComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClaimResponseErrorComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
      res.setStatusReason(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("performer")) {
      res.setPerformer(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("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(parseClinicalImpressionFindingComponent(xpp));
    } 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.ClinicalImpressionFindingComponent parseClinicalImpressionFindingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClinicalImpressionFindingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClinicalImpressionFindingComponentContent(int eventType, XmlPullParser xpp, ClinicalImpression.ClinicalImpressionFindingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.setItem(parseCodeableReference(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 ClinicalUseIssue parseClinicalUseIssue(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ClinicalUseIssue res = new ClinicalUseIssue();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClinicalUseIssueContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClinicalUseIssueContent(int eventType, XmlPullParser xpp, ClinicalUseIssue 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, ClinicalUseIssue.ClinicalUseIssueType.NULL, new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
      res.setCategory(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("status")) {
      res.setStatus(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("contraindication")) {
      res.setContraindication(parseClinicalUseIssueContraindicationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indication")) {
      res.setIndication(parseClinicalUseIssueIndicationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
      res.setInteraction(parseClinicalUseIssueInteractionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.getPopulation().add(parsePopulation(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("undesirableEffect")) {
      res.setUndesirableEffect(parseClinicalUseIssueUndesirableEffectComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClinicalUseIssueContraindicationComponentContent(int eventType, XmlPullParser xpp, ClinicalUseIssue.ClinicalUseIssueContraindicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    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("indication")) {
      res.getIndication().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherTherapy")) {
      res.getOtherTherapy().add(parseClinicalUseIssueContraindicationOtherTherapyComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClinicalUseIssueContraindicationOtherTherapyComponentContent(int eventType, XmlPullParser xpp, ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent 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 ClinicalUseIssue.ClinicalUseIssueIndicationComponent parseClinicalUseIssueIndicationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ClinicalUseIssue.ClinicalUseIssueIndicationComponent res = new ClinicalUseIssue.ClinicalUseIssueIndicationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClinicalUseIssueIndicationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseClinicalUseIssueIndicationComponentContent(int eventType, XmlPullParser xpp, ClinicalUseIssue.ClinicalUseIssueIndicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    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("undesirableEffect")) {
      res.getUndesirableEffect().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherTherapy")) {
      res.getOtherTherapy().add(parseClinicalUseIssueContraindicationOtherTherapyComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClinicalUseIssueInteractionComponentContent(int eventType, XmlPullParser xpp, ClinicalUseIssue.ClinicalUseIssueInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interactant")) {
      res.getInteractant().add(parseClinicalUseIssueInteractionInteractantComponent(xpp));
    } 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 (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseClinicalUseIssueInteractionInteractantComponentContent(int eventType, XmlPullParser xpp, ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent 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 ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent parseClinicalUseIssueUndesirableEffectComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent res = new ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseClinicalUseIssueUndesirableEffectComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

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

  protected CodeSystem parseCodeSystem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem res = new CodeSystem();
    parseResourceAttributes(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(parseCodeSystemFilterComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseCodeSystemPropertyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
      res.getConcept().add(parseCodeSystemConceptDefinitionComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCodeSystemFilterComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.FilterOperator.NULL, new Enumerations.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) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCodeSystemPropertyComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemPropertyComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCodeSystemConceptDefinitionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemConceptDefinitionComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseCodeSystemConceptPropertyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
      res.getConcept().add(parseCodeSystemConceptDefinitionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCodeSystemConceptDefinitionDesignationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCodeSystemConceptPropertyComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCodeSystemConceptPropertyComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
    } 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, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
    } 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("reason")) {
      res.getReason().add(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payload")) {
      res.getPayload().add(parseCommunicationPayloadComponent(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 Communication.CommunicationPayloadComponent parseCommunicationPayloadComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCommunicationPayloadComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCommunicationPayloadComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
    } 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, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
    } 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(parseCommunicationRequestPayloadComponent(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("recipient")) {
      res.getRecipient().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationProvider")) {
      res.getInformationProvider().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
      res.getReason().add(parseCodeableReference(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 parseCommunicationRequestPayloadComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCommunicationRequestPayloadComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCommunicationRequestPayloadComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.CompartmentType.NULL, new Enumerations.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(parseCompartmentDefinitionResourceComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCompartmentDefinitionResourceComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.CompositionStatus.NULL, new Enumerations.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.V3ConfidentialityClassification.NULL, new Composition.V3ConfidentialityClassificationEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attester")) {
      res.getAttester().add(parseCompositionAttesterComponent(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(parseCompositionRelatesToComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
      res.getEvent().add(parseCompositionEventComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("section")) {
      res.getSection().add(parseCompositionSectionComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCompositionAttesterComponentContent(int eventType, XmlPullParser xpp, 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 parseCompositionRelatesToComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCompositionRelatesToComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionRelatesToComponentContent(int eventType, XmlPullParser xpp, Composition.CompositionRelatesToComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCodeElement(parseEnumeration(xpp, Enumerations.DocumentRelationshipType.NULL, new Enumerations.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 parseCompositionEventComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCompositionEventComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionEventComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Composition.SectionComponent res = new Composition.SectionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCompositionSectionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCompositionSectionComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
    } 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ConceptMap parseConceptMap(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap res = new ConceptMap();
    parseResourceAttributes(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.addIdentifier(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(parseConceptMapGroupComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConceptMapGroupComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unmapped")) {
      res.setUnmapped(parseConceptMapGroupUnmappedComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConceptMapSourceElementComponentContent(int eventType, XmlPullParser xpp, 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("noMap")) {
      res.setNoMapElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
      res.getTarget().add(parseConceptMapTargetElementComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConceptMapTargetElementComponentContent(int eventType, XmlPullParser xpp, 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("relationship")) {
      res.setRelationshipElement(parseEnumeration(xpp, Enumerations.ConceptMapRelationship.NULL, new Enumerations.ConceptMapRelationshipEnumFactory()));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("product")) {
      res.getProduct().add(parseConceptMapOtherElementComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConceptMapOtherElementComponentContent(int eventType, XmlPullParser xpp, 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 parseConceptMapGroupUnmappedComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConceptMapGroupUnmappedComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConceptMapGroupUnmappedComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseConditionStageComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("evidence")) {
      res.getEvidence().add(parseConditionEvidenceComponent(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 Condition.ConditionStageComponent parseConditionStageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConditionStageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionStageComponentContent(int eventType, XmlPullParser xpp, 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 parseConditionEvidenceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConditionEvidenceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionEvidenceComponentContent(int eventType, XmlPullParser xpp, 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 ConditionDefinition parseConditionDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ConditionDefinition res = new ConditionDefinition();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConditionDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionDefinitionContent(int eventType, XmlPullParser xpp, ConditionDefinition 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("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("code")) {
      res.setCode(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("bodySite")) {
      res.setBodySite(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stage")) {
      res.setStage(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasSeverity")) {
      res.setHasSeverityElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasBodySite")) {
      res.setHasBodySiteElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasStage")) {
      res.setHasStageElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
      res.getDefinition().add(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observation")) {
      res.getObservation().add(parseConditionDefinitionObservationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medication")) {
      res.getMedication().add(parseConditionDefinitionMedicationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precondition")) {
      res.getPrecondition().add(parseConditionDefinitionPreconditionComponent(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("questionnaire")) {
      res.getQuestionnaire().add(parseConditionDefinitionQuestionnaireComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("plan")) {
      res.getPlan().add(parseConditionDefinitionPlanComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConditionDefinitionObservationComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionObservationComponent 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 (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConditionDefinitionMedicationComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionMedicationComponent 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 (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConditionDefinitionPreconditionComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionPreconditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, ConditionDefinition.ConditionPreconditionType.NULL, new ConditionDefinition.ConditionPreconditionTypeEnumFactory()));
    } else 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 ConditionDefinition.ConditionDefinitionQuestionnaireComponent parseConditionDefinitionQuestionnaireComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ConditionDefinition.ConditionDefinitionQuestionnaireComponent res = new ConditionDefinition.ConditionDefinitionQuestionnaireComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConditionDefinitionQuestionnaireComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionDefinitionQuestionnaireComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionQuestionnaireComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
      res.setPurposeElement(parseEnumeration(xpp, ConditionDefinition.ConditionQuestionnairePurpose.NULL, new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory()));
    } 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 ConditionDefinition.ConditionDefinitionPlanComponent parseConditionDefinitionPlanComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ConditionDefinition.ConditionDefinitionPlanComponent res = new ConditionDefinition.ConditionDefinitionPlanComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConditionDefinitionPlanComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConditionDefinitionPlanComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionPlanComponent 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 parseConsent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent res = new Consent();
    parseResourceAttributes(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("subject")) {
      res.setSubject(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 && xpp.getName().equals("sourceAttachment")) {
      res.getSourceAttachment().add(parseAttachment(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceReference")) {
      res.getSourceReference().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("policy")) {
      res.getPolicy().add(parseConsentPolicyComponent(xpp));
    } 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(parseConsentVerificationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provision")) {
      res.setProvision(parseConsentProvisionComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConsentPolicyComponentContent(int eventType, XmlPullParser xpp, 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 parseConsentVerificationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConsentVerificationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentVerificationComponentContent(int eventType, XmlPullParser xpp, 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("verificationType")) {
      res.setVerificationType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verifiedBy")) {
      res.setVerifiedBy(parseReference(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.getVerificationDate().add(parseDateTime(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConsentProvisionComponentContent(int eventType, XmlPullParser xpp, 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));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provision")) {
      res.getProvision().add(parseConsentProvisionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseConsentProvisionActorComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Consent.ProvisionDataComponent res = new Consent.ProvisionDataComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseConsentProvisionDataComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseConsentProvisionDataComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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.ContractResourceStatusCodes.NULL, new Contract.ContractResourceStatusCodesEnumFactory()));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("term")) {
      res.getTerm().add(parseContractTermComponent(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("relevantHistory")) {
      res.getRelevantHistory().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("signer")) {
      res.getSigner().add(parseContractSignatoryComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("friendly")) {
      res.getFriendly().add(parseContractFriendlyLanguageComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("legal")) {
      res.getLegal().add(parseContractLegalLanguageComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
      res.getRule().add(parseContractComputableLanguageComponent(xpp));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractContentDefinitionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractContentDefinitionComponentContent(int eventType, XmlPullParser xpp, 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.ContractResourcePublicationStatusCodes.NULL, new Contract.ContractResourcePublicationStatusCodesEnumFactory()));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.TermComponent res = new Contract.TermComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractTermComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractTermComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("offer")) {
      res.setOffer(parseContractOfferComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("asset")) {
      res.getAsset().add(parseContractAssetComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parseContractActionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
      res.getGroup().add(parseContractTermComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseContractSecurityLabelComponentContent(int eventType, XmlPullParser xpp, 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 parseContractOfferComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractOfferComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractOfferComponentContent(int eventType, XmlPullParser xpp, 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(parseContractPartyComponent(xpp));
    } 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));
    } 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 parseContractPartyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractPartyComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractPartyComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.AnswerComponent res = new Contract.AnswerComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractAnswerComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractAnswerComponentContent(int eventType, XmlPullParser xpp, 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 parseContractAssetComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractAssetComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractAssetComponentContent(int eventType, XmlPullParser xpp, 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));
    } 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));
    } 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseContractAssetContextComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractValuedItemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractValuedItemComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ActionComponent res = new Contract.ActionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractActionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractActionComponentContent(int eventType, XmlPullParser xpp, 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));
    } 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("reason")) {
      res.getReason().add(parseCodeableReference(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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractActionSubjectComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractActionSubjectComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractSignatoryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractSignatoryComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractFriendlyLanguageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractFriendlyLanguageComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractLegalLanguageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractLegalLanguageComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseContractComputableLanguageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseContractComputableLanguageComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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.setSubscriberId(parseIdentifier(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));
    } 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));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Coverage.ClassComponent res = new Coverage.ClassComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCoverageClassComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageClassComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Coverage.CostToBeneficiaryComponent res = new Coverage.CostToBeneficiaryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCoverageCostToBeneficiaryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageCostToBeneficiaryComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCoverageExemptionComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
      res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCoverageEligibilityRequestSupportingInformationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCoverageEligibilityRequestInsuranceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageEligibilityRequestInsuranceComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCoverageEligibilityRequestDetailsComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageEligibilityRequestDetailsComponentContent(int eventType, XmlPullParser xpp, 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));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCoverageEligibilityRequestDiagnosisComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageEligibilityRequestDiagnosisComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
    } 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));
    } 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));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCoverageEligibilityResponseInsuranceComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseCoverageEligibilityResponseItemsComponentContent(int eventType, XmlPullParser xpp, 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));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCoverageEligibilityResponseBenefitComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageEligibilityResponseBenefitComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseCoverageEligibilityResponseErrorsComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseCoverageEligibilityResponseErrorsComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
    } 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(parseDetectedIssueEvidenceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
      res.setDetailElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
      res.setReferenceElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mitigation")) {
      res.getMitigation().add(parseDetectedIssueMitigationComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDetectedIssueEvidenceComponentContent(int eventType, XmlPullParser xpp, 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 parseDetectedIssueMitigationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDetectedIssueMitigationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDetectedIssueMitigationComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("displayName")) {
      res.setDisplayNameElement(parseString(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(parseDeviceUdiCarrierComponent(xpp));
    } 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(parseDeviceDeviceNameComponent(xpp));
    } 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.getType().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialization")) {
      res.getSpecialization().add(parseDeviceSpecializationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.getVersion().add(parseDeviceVersionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseDevicePropertyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
      res.setPatient(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operationalStatus")) {
      res.setOperationalStatus(parseDeviceOperationalStatusComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("associationStatus")) {
      res.setAssociationStatus(parseDeviceAssociationStatusComponent(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 parseDeviceUdiCarrierComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceUdiCarrierComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceUdiCarrierComponentContent(int eventType, XmlPullParser xpp, 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 parseDeviceDeviceNameComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceDeviceNameComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDeviceNameComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDeviceSpecializationComponentContent(int eventType, XmlPullParser xpp, 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 parseDeviceVersionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceVersionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceVersionComponentContent(int eventType, XmlPullParser xpp, 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 parseDevicePropertyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDevicePropertyComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDevicePropertyComponentContent(int eventType, XmlPullParser xpp, 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 Device.DeviceOperationalStatusComponent parseDeviceOperationalStatusComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Device.DeviceOperationalStatusComponent res = new Device.DeviceOperationalStatusComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceOperationalStatusComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceOperationalStatusComponentContent(int eventType, XmlPullParser xpp, Device.DeviceOperationalStatusComponent 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("reason")) {
      res.getReason().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDeviceAssociationStatusComponentContent(int eventType, XmlPullParser xpp, Device.DeviceAssociationStatusComponent 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("reason")) {
      res.getReason().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();
    parseResourceAttributes(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(parseDeviceDefinitionUdiDeviceIdentifierComponent(xpp));
    } 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(parseDeviceDefinitionDeviceNameComponent(xpp));
    } 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(parseDeviceDefinitionSpecializationComponent(xpp));
    } 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(parseDeviceDefinitionCapabilityComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseDeviceDefinitionPropertyComponent(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("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(parseDeviceDefinitionMaterialComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDeviceDefinitionUdiDeviceIdentifierComponentContent(int eventType, XmlPullParser xpp, 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 parseDeviceDefinitionDeviceNameComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceDefinitionDeviceNameComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionDeviceNameComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.DeviceNameType.NULL, new Enumerations.DeviceNameTypeEnumFactory()));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDeviceDefinitionSpecializationComponentContent(int eventType, XmlPullParser xpp, 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 parseDeviceDefinitionCapabilityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceDefinitionCapabilityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionCapabilityComponentContent(int eventType, XmlPullParser xpp, 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 parseDeviceDefinitionPropertyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceDefinitionPropertyComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionPropertyComponentContent(int eventType, XmlPullParser xpp, 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 parseDeviceDefinitionMaterialComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceDefinitionMaterialComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceDefinitionMaterialComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseDeviceMetricCalibrationComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDeviceMetricCalibrationComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntentElement(parseEnumeration(xpp, Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
      res.setPriorityElement(parseEnumeration(xpp, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCode(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
      res.getParameter().add(parseDeviceRequestParameterComponent(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("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("reason")) {
      res.getReason().add(parseCodeableReference(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 parseDeviceRequestParameterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDeviceRequestParameterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDeviceRequestParameterComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("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("derivedFrom")) {
      res.getDerivedFrom().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
      res.setContext(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("dateAsserted")) {
      res.setDateAssertedElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usageStatus")) {
      res.setUsageStatus(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usageReason")) {
      res.getUsageReason().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationSource")) {
      res.setInformationSource(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
      res.setDevice(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
      res.getReason().add(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
      res.setBodySite(parseCodeableReference(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();
    parseResourceAttributes(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(parseDiagnosticReportMediaComponent(xpp));
    } 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 parseDiagnosticReportMediaComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDiagnosticReportMediaComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDiagnosticReportMediaComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseDocumentManifestRelatedComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDocumentManifestRelatedComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.CompositionStatus.NULL, new Enumerations.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("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(parseDocumentReferenceRelatesToComponent(xpp));
    } 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(parseDocumentReferenceContentComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
      res.setContext(parseDocumentReferenceContextComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseDocumentReferenceRelatesToComponentContent(int eventType, XmlPullParser xpp, DocumentReference.DocumentReferenceRelatesToComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.setCodeElement(parseEnumeration(xpp, Enumerations.DocumentRelationshipType.NULL, new Enumerations.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 parseDocumentReferenceContentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDocumentReferenceContentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentReferenceContentComponentContent(int eventType, XmlPullParser xpp, 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 parseDocumentReferenceContextComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseDocumentReferenceContextComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseDocumentReferenceContextComponentContent(int eventType, XmlPullParser xpp, 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
      res.getBasedOn().add(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Encounter parseEncounter(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter res = new Encounter();
    parseResourceAttributes(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));
    } 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));
    } 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("subjectStatus")) {
      res.setSubjectStatus(parseCodeableConcept(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(parseEncounterParticipantComponent(xpp));
    } 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("reason")) {
      res.getReason().add(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
      res.getDiagnosis().add(parseEncounterDiagnosisComponent(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("hospitalization")) {
      res.setHospitalization(parseEncounterHospitalizationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
      res.getLocation().add(parseEncounterLocationComponent(xpp));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEncounterStatusHistoryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterStatusHistoryComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEncounterClassHistoryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterClassHistoryComponentContent(int eventType, XmlPullParser xpp, 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 parseEncounterParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEncounterParticipantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterParticipantComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEncounterDiagnosisComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterDiagnosisComponentContent(int eventType, XmlPullParser xpp, 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 parseEncounterHospitalizationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEncounterHospitalizationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterHospitalizationComponentContent(int eventType, XmlPullParser xpp, 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 parseEncounterLocationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEncounterLocationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEncounterLocationComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
    } 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();
    parseResourceAttributes(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(parseEpisodeOfCareStatusHistoryComponent(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("diagnosis")) {
      res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(xpp));
    } 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 parseEpisodeOfCareStatusHistoryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEpisodeOfCareStatusHistoryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEpisodeOfCareStatusHistoryComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEpisodeOfCareDiagnosisComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEpisodeOfCareDiagnosisComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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 (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Evidence parseEvidence(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Evidence res = new Evidence();
    parseResourceAttributes(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("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("useContext")) {
      res.getUseContext().add(parseUsageContext(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("contributor")) {
      res.getContributor().add(parseContributor(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("description")) {
      res.setDescriptionElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assertion")) {
      res.setAssertionElement(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("variableDefinition")) {
      res.getVariableDefinition().add(parseEvidenceVariableDefinitionComponent(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("statistic")) {
      res.getStatistic().add(parseStatistic(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("distribution")) {
      res.getDistribution().add(parseOrderedDistribution(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("certainty")) {
      res.getCertainty().add(parseEvidenceCertaintyComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseEvidenceVariableDefinitionComponentContent(int eventType, XmlPullParser xpp, Evidence.EvidenceVariableDefinitionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    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("variableRole")) {
      res.setVariableRole(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observed")) {
      res.setObserved(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intended")) {
      res.setIntended(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("directnessMatch")) {
      res.setDirectnessMatch(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseEvidenceCertaintyComponentContent(int eventType, XmlPullParser xpp, Evidence.EvidenceCertaintyComponent 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("note")) {
      res.setNote(parseAnnotation(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("certaintySubcomponent")) {
      res.getCertaintySubcomponent().add(parseEvidenceCertaintyCertaintySubcomponentComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseEvidenceCertaintyCertaintySubcomponentComponentContent(int eventType, XmlPullParser xpp, Evidence.EvidenceCertaintyCertaintySubcomponentComponent 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("note")) {
      res.setNote(parseAnnotation(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("rating")) {
      res.getRating().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseEvidenceFocusContent(int eventType, XmlPullParser xpp, EvidenceFocus 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("useContext")) {
      res.getUseContext().add(parseUsageContext(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
      res.setDateElement(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("copyright")) {
      res.setCopyrightElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citeAs")) {
      res.setCiteAs(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("characteristic")) {
      res.getCharacteristic().add(parseEvidenceFocusCharacteristicComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
      res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseEvidenceFocusCharacteristicComponentContent(int eventType, XmlPullParser xpp, EvidenceFocus.EvidenceFocusCharacteristicComponent 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 EvidenceVariable parseEvidenceVariable(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EvidenceVariable res = new EvidenceVariable();
    parseResourceAttributes(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("actual")) {
      res.setActualElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("characteristicCombination")) {
      res.setCharacteristicCombinationElement(parseEnumeration(xpp, EvidenceVariable.CharacteristicCombination.NULL, new EvidenceVariable.CharacteristicCombinationEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("characteristic")) {
      res.getCharacteristic().add(parseEvidenceVariableCharacteristicComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseEvidenceVariableCharacteristicComponentContent(int eventType, XmlPullParser xpp, 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("method")) {
      res.setMethod(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
      res.setDevice(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
      res.setExcludeElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timeFromStart")) {
      res.setTimeFromStart(parseEvidenceVariableCharacteristicTimeFromStartComponent(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 EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent parseEvidenceVariableCharacteristicTimeFromStartComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent res = new EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseEvidenceVariableCharacteristicTimeFromStartComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseEvidenceVariableCharacteristicTimeFromStartComponentContent(int eventType, XmlPullParser xpp, EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent 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("quantity")) {
      res.setQuantity(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("range")) {
      res.setRange(parseRange(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 ExampleScenario parseExampleScenario(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario res = new ExampleScenario();
    parseResourceAttributes(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("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("actor")) {
      res.getActor().add(parseExampleScenarioActorComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
      res.getInstance().add(parseExampleScenarioInstanceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("process")) {
      res.getProcess().add(parseExampleScenarioProcessComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("workflow")) {
      res.getWorkflow().add(parseCanonical(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExampleScenarioActorComponentContent(int eventType, XmlPullParser xpp, 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 parseExampleScenarioInstanceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExampleScenarioInstanceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioInstanceComponentContent(int eventType, XmlPullParser xpp, 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(parseCode(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(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.getVersion().add(parseExampleScenarioInstanceVersionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("containedInstance")) {
      res.getContainedInstance().add(parseExampleScenarioInstanceContainedInstanceComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExampleScenarioInstanceVersionComponentContent(int eventType, XmlPullParser xpp, 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 parseExampleScenarioInstanceContainedInstanceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExampleScenarioInstanceContainedInstanceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioInstanceContainedInstanceComponentContent(int eventType, XmlPullParser xpp, 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 parseExampleScenarioProcessComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExampleScenarioProcessComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExampleScenarioProcessComponentContent(int eventType, XmlPullParser xpp, 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(parseExampleScenarioProcessStepComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExampleScenarioProcessStepComponentContent(int eventType, XmlPullParser xpp, ExampleScenario.ExampleScenarioProcessStepComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("process")) {
      res.getProcess().add(parseExampleScenarioProcessComponent(xpp));
    } 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(parseExampleScenarioProcessStepOperationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alternative")) {
      res.getAlternative().add(parseExampleScenarioProcessStepAlternativeComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExampleScenarioProcessStepOperationComponentContent(int eventType, XmlPullParser xpp, 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(parseExampleScenarioInstanceContainedInstanceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
      res.setResponse(parseExampleScenarioInstanceContainedInstanceComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExampleScenarioProcessStepAlternativeComponentContent(int eventType, XmlPullParser xpp, 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(parseExampleScenarioProcessStepComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ExplanationOfBenefit parseExplanationOfBenefit(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit res = new ExplanationOfBenefit();
    parseResourceAttributes(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, Enumerations.Use.NULL, new Enumerations.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));
    } 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));
    } 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, Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
      res.getSupportingInfo().add(parseExplanationOfBenefitSupportingInformationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
      res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
      res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(xpp));
    } 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accident")) {
      res.setAccident(parseExplanationOfBenefitAccidentComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseExplanationOfBenefitItemComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addItem")) {
      res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
      res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
      res.getTotal().add(parseExplanationOfBenefitTotalComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
      res.setPayment(parseExplanationOfBenefitPaymentComponent(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(parseExplanationOfBenefitNoteComponent(xpp));
    } 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));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitRelatedClaimComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitPayeeComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitPayeeComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitCareTeamComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitCareTeamComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitSupportingInformationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitSupportingInformationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitDiagnosisComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitDiagnosisComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitProcedureComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitProcedureComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitInsuranceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitInsuranceComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitAccidentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitAccidentComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitItemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitItemComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
      res.getDetail().add(parseExplanationOfBenefitDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitAdjudicationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitDetailComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
      res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitSubDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitAddedItemComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
      res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitAddedItemDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
      res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitAddedItemDetailSubDetailComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitTotalComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitPaymentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitPaymentComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitNoteComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitNoteComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseExplanationOfBenefitBenefitBalanceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseExplanationOfBenefitBenefitBalanceComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseExplanationOfBenefitBenefitComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("reason")) {
      res.getReason().add(parseCodeableReference(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(parseFamilyMemberHistoryConditionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
      res.getProcedure().add(parseFamilyMemberHistoryProcedureComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseFamilyMemberHistoryConditionComponentContent(int eventType, XmlPullParser xpp, 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 FamilyMemberHistory.FamilyMemberHistoryProcedureComponent parseFamilyMemberHistoryProcedureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    FamilyMemberHistory.FamilyMemberHistoryProcedureComponent res = new FamilyMemberHistory.FamilyMemberHistoryProcedureComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseFamilyMemberHistoryProcedureComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseFamilyMemberHistoryProcedureComponentContent(int eventType, XmlPullParser xpp, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent 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, "performed")) {
      res.setPerformed(parseType("performed", 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();
    parseResourceAttributes(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();
    parseResourceAttributes(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("continuous")) {
      res.setContinuousElement(parseBoolean(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(parseGoalTargetComponent(xpp));
    } 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("outcome")) {
      res.getOutcome().add(parseCodeableReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseGoalTargetComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseGraphDefinitionLinkComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseGraphDefinitionLinkComponentContent(int eventType, XmlPullParser xpp, 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(parseGraphDefinitionLinkTargetComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseGraphDefinitionLinkTargetComponentContent(int eventType, XmlPullParser xpp, 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(parseGraphDefinitionLinkTargetCompartmentComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
      res.getLink().add(parseGraphDefinitionLinkComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseGraphDefinitionLinkTargetCompartmentComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
    } 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();
    parseResourceAttributes(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(parseGroupCharacteristicComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("member")) {
      res.getMember().add(parseGroupMemberComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseGroupCharacteristicComponentContent(int eventType, XmlPullParser xpp, 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 parseGroupMemberComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseGroupMemberComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseGroupMemberComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("reason")) {
      res.getReason().add(parseCodeableReference(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();
    parseResourceAttributes(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(parseHealthcareServiceEligibilityComponent(xpp));
    } 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(parseHealthcareServiceAvailableTimeComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notAvailable")) {
      res.getNotAvailable().add(parseHealthcareServiceNotAvailableComponent(xpp));
    } 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 parseHealthcareServiceEligibilityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    HealthcareService.HealthcareServiceEligibilityComponent res = new HealthcareService.HealthcareServiceEligibilityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseHealthcareServiceEligibilityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHealthcareServiceEligibilityComponentContent(int eventType, XmlPullParser xpp, 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 parseHealthcareServiceAvailableTimeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseHealthcareServiceAvailableTimeComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHealthcareServiceAvailableTimeComponentContent(int eventType, XmlPullParser xpp, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysOfWeek")) {
      res.getDaysOfWeek().add(parseEnumeration(xpp, Enumerations.DaysOfWeek.NULL, new Enumerations.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 parseHealthcareServiceNotAvailableComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseHealthcareServiceNotAvailableComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseHealthcareServiceNotAvailableComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("procedure")) {
      res.getProcedure().add(parseImagingStudyProcedureComponent(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(parseCodeableReference(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(parseImagingStudySeriesComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseImagingStudyProcedureComponentContent(int eventType, XmlPullParser xpp, ImagingStudy.ImagingStudyProcedureComponent 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 ImagingStudy.ImagingStudySeriesComponent parseImagingStudySeriesComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImagingStudySeriesComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingStudySeriesComponentContent(int eventType, XmlPullParser xpp, 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(parseImagingStudySeriesPerformerComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
      res.getInstance().add(parseImagingStudySeriesInstanceComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseImagingStudySeriesPerformerComponentContent(int eventType, XmlPullParser xpp, 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 parseImagingStudySeriesInstanceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImagingStudySeriesInstanceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImagingStudySeriesInstanceComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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.ImmunizationStatusCodes.NULL, new Immunization.ImmunizationStatusCodesEnumFactory()));
    } 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 && nameIsTypeName(xpp, "informationSource")) {
      res.setInformationSource(parseType("informationSource", 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(parseImmunizationPerformerComponent(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("reason")) {
      res.getReason().add(parseCodeableReference(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(parseImmunizationEducationComponent(xpp));
    } 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(parseImmunizationReactionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocolApplied")) {
      res.getProtocolApplied().add(parseImmunizationProtocolAppliedComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseImmunizationPerformerComponentContent(int eventType, XmlPullParser xpp, 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 parseImmunizationEducationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImmunizationEducationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationEducationComponentContent(int eventType, XmlPullParser xpp, 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 parseImmunizationReactionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization.ImmunizationReactionComponent res = new Immunization.ImmunizationReactionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImmunizationReactionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationReactionComponentContent(int eventType, XmlPullParser xpp, 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 parseImmunizationProtocolAppliedComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImmunizationProtocolAppliedComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationProtocolAppliedComponentContent(int eventType, XmlPullParser xpp, 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 && xpp.getName().equals("doseNumber")) {
      res.setDoseNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("seriesDoses")) {
      res.setSeriesDosesElement(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ImmunizationEvaluation parseImmunizationEvaluation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImmunizationEvaluation res = new ImmunizationEvaluation();
    parseResourceAttributes(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.ImmunizationEvaluationStatusCodes.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusCodesEnumFactory()));
    } 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 && xpp.getName().equals("doseNumber")) {
      res.setDoseNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("seriesDoses")) {
      res.setSeriesDosesElement(parseString(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ImmunizationRecommendation parseImmunizationRecommendation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImmunizationRecommendation res = new ImmunizationRecommendation();
    parseResourceAttributes(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(parseImmunizationRecommendationRecommendationComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseImmunizationRecommendationRecommendationComponentContent(int eventType, XmlPullParser xpp, 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.getTargetDisease().add(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(parseImmunizationRecommendationRecommendationDateCriterionComponent(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 && xpp.getName().equals("doseNumber")) {
      res.setDoseNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("seriesDoses")) {
      res.setSeriesDosesElement(parseString(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 parseImmunizationRecommendationRecommendationDateCriterionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImmunizationRecommendationRecommendationDateCriterionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImmunizationRecommendationRecommendationDateCriterionComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseImplementationGuideDependsOnComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("global")) {
      res.getGlobal().add(parseImplementationGuideGlobalComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
      res.setDefinition(parseImplementationGuideDefinitionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manifest")) {
      res.setManifest(parseImplementationGuideManifestComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseImplementationGuideDependsOnComponentContent(int eventType, XmlPullParser xpp, 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 parseImplementationGuideGlobalComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideGlobalComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideGlobalComponentContent(int eventType, XmlPullParser xpp, 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 parseImplementationGuideDefinitionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideDefinitionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideDefinitionComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("grouping")) {
      res.getGrouping().add(parseImplementationGuideDefinitionGroupingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
      res.getResource().add(parseImplementationGuideDefinitionResourceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("page")) {
      res.setPage(parseImplementationGuideDefinitionPageComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) {
      res.getParameter().add(parseImplementationGuideDefinitionParameterComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("template")) {
      res.getTemplate().add(parseImplementationGuideDefinitionTemplateComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseImplementationGuideDefinitionGroupingComponentContent(int eventType, XmlPullParser xpp, 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 parseImplementationGuideDefinitionResourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideDefinitionResourceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideDefinitionResourceComponentContent(int eventType, XmlPullParser xpp, 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 parseImplementationGuideDefinitionPageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideDefinitionPageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideDefinitionPageComponentContent(int eventType, XmlPullParser xpp, 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(parseImplementationGuideDefinitionPageComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseImplementationGuideDefinitionParameterComponentContent(int eventType, XmlPullParser xpp, 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 parseImplementationGuideDefinitionTemplateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideDefinitionTemplateComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideDefinitionTemplateComponentContent(int eventType, XmlPullParser xpp, 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 parseImplementationGuideManifestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideManifestComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideManifestComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("page")) {
      res.getPage().add(parseImplementationGuideManifestPageComponent(xpp));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideManifestResourceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideManifestResourceComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseImplementationGuideManifestPageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseImplementationGuideManifestPageComponentContent(int eventType, XmlPullParser xpp, 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 Ingredient parseIngredient(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Ingredient res = new Ingredient();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseIngredientContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseIngredientContent(int eventType, XmlPullParser xpp, Ingredient 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("function")) {
      res.getFunction().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("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(parseIngredientSpecifiedSubstanceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substance")) {
      res.setSubstance(parseIngredientSubstanceComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseIngredientSpecifiedSubstanceComponentContent(int eventType, XmlPullParser xpp, Ingredient.IngredientSpecifiedSubstanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "code")) {
      res.setCode(parseType("code", 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(parseIngredientSpecifiedSubstanceStrengthComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseIngredientSpecifiedSubstanceStrengthComponentContent(int eventType, XmlPullParser xpp, Ingredient.IngredientSpecifiedSubstanceStrengthComponent 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("presentationHighLimit")) {
      res.setPresentationHighLimit(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("presentationText")) {
      res.setPresentationTextElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concentration")) {
      res.setConcentration(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concentrationHighLimit")) {
      res.setConcentrationHighLimit(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concentrationText")) {
      res.setConcentrationTextElement(parseString(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(parseIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentContent(int eventType, XmlPullParser xpp, Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent 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("strength")) {
      res.setStrength(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strengthHighLimit")) {
      res.setStrengthHighLimit(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 Ingredient.IngredientSubstanceComponent parseIngredientSubstanceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Ingredient.IngredientSubstanceComponent res = new Ingredient.IngredientSubstanceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseIngredientSubstanceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseIngredientSubstanceComponentContent(int eventType, XmlPullParser xpp, Ingredient.IngredientSubstanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "code")) {
      res.setCode(parseType("code", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strength")) {
      res.getStrength().add(parseIngredientSpecifiedSubstanceStrengthComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected InsurancePlan parseInsurancePlan(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan res = new InsurancePlan();
    parseResourceAttributes(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(parseInsurancePlanContactComponent(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("network")) {
      res.getNetwork().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
      res.getCoverage().add(parseInsurancePlanCoverageComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("plan")) {
      res.getPlan().add(parseInsurancePlanPlanComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseInsurancePlanContactComponentContent(int eventType, XmlPullParser xpp, 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 parseInsurancePlanCoverageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseInsurancePlanCoverageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanCoverageComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseInsurancePlanCoverageBenefitComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseInsurancePlanCoverageBenefitLimitComponentContent(int eventType, XmlPullParser xpp, 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 parseInsurancePlanPlanComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseInsurancePlanPlanComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanPlanComponentContent(int eventType, XmlPullParser xpp, 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(parseInsurancePlanPlanGeneralCostComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specificCost")) {
      res.getSpecificCost().add(parseInsurancePlanPlanSpecificCostComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseInsurancePlanPlanGeneralCostComponentContent(int eventType, XmlPullParser xpp, 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 parseInsurancePlanPlanSpecificCostComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseInsurancePlanPlanSpecificCostComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInsurancePlanPlanSpecificCostComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseInsurancePlanPlanBenefitComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseInsurancePlanPlanBenefitCostComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseInvoiceParticipantComponent(xpp));
    } 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(parseInvoiceLineItemComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalPriceComponent")) {
      res.getTotalPriceComponent().add(parseInvoiceLineItemPriceComponentComponent(xpp));
    } 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 parseInvoiceParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseInvoiceParticipantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInvoiceParticipantComponentContent(int eventType, XmlPullParser xpp, 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 parseInvoiceLineItemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseInvoiceLineItemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseInvoiceLineItemComponentContent(int eventType, XmlPullParser xpp, 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(parseInvoiceLineItemPriceComponentComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseInvoiceLineItemPriceComponentComponentContent(int eventType, XmlPullParser xpp, Invoice.InvoiceLineItemPriceComponentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, Enumerations.InvoicePriceComponentType.NULL, new Enumerations.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();
    parseResourceAttributes(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 (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Linkage parseLinkage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Linkage res = new Linkage();
    parseResourceAttributes(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(parseLinkageItemComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseLinkageItemComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.ListMode.NULL, new Enumerations.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(parseListResourceEntryComponent(xpp));
    } 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.ListResourceEntryComponent parseListResourceEntryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ListResource.ListResourceEntryComponent res = new ListResource.ListResourceEntryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseListResourceEntryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseListResourceEntryComponentContent(int eventType, XmlPullParser xpp, ListResource.ListResourceEntryComponent 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();
    parseResourceAttributes(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(parseLocationPositionComponent(xpp));
    } 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(parseLocationHoursOfOperationComponent(xpp));
    } 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 parseLocationPositionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseLocationPositionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseLocationPositionComponentContent(int eventType, XmlPullParser xpp, 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 parseLocationHoursOfOperationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseLocationHoursOfOperationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseLocationHoursOfOperationComponentContent(int eventType, XmlPullParser xpp, Location.LocationHoursOfOperationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysOfWeek")) {
      res.getDaysOfWeek().add(parseEnumeration(xpp, Enumerations.DaysOfWeek.NULL, new Enumerations.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 ManufacturedItemDefinition parseManufacturedItemDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ManufacturedItemDefinition res = new ManufacturedItemDefinition();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseManufacturedItemDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseManufacturedItemDefinitionContent(int eventType, XmlPullParser xpp, ManufacturedItemDefinition 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("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("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("property")) {
      res.getProperty().add(parseManufacturedItemDefinitionPropertyComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseManufacturedItemDefinitionPropertyComponentContent(int eventType, XmlPullParser xpp, ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent 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 Measure parseMeasure(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure res = new Measure();
    parseResourceAttributes(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(parseMeasureGroupComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplementalData")) {
      res.getSupplementalData().add(parseMeasureSupplementalDataComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMeasureGroupComponentContent(int eventType, XmlPullParser xpp, 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(parseMeasureGroupPopulationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stratifier")) {
      res.getStratifier().add(parseMeasureGroupStratifierComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMeasureGroupPopulationComponentContent(int eventType, XmlPullParser xpp, 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 parseMeasureGroupStratifierComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMeasureGroupStratifierComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureGroupStratifierComponentContent(int eventType, XmlPullParser xpp, 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(parseMeasureGroupStratifierComponentComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMeasureGroupStratifierComponentComponentContent(int eventType, XmlPullParser xpp, 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 parseMeasureSupplementalDataComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMeasureSupplementalDataComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureSupplementalDataComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseMeasureReportGroupComponent(xpp));
    } 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 parseMeasureReportGroupComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMeasureReportGroupComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportGroupComponentContent(int eventType, XmlPullParser xpp, 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(parseMeasureReportGroupPopulationComponent(xpp));
    } 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(parseMeasureReportGroupStratifierComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMeasureReportGroupPopulationComponentContent(int eventType, XmlPullParser xpp, 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 parseMeasureReportGroupStratifierComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMeasureReportGroupStratifierComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportGroupStratifierComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMeasureReportStratifierGroupComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
      res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(xpp));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.StratifierGroupComponentComponent res = new MeasureReport.StratifierGroupComponentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMeasureReportStratifierGroupComponentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportStratifierGroupComponentComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMeasureReportStratifierGroupPopulationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMeasureReportStratifierGroupPopulationComponentContent(int eventType, XmlPullParser xpp, 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 Medication parseMedication(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Medication res = new Medication();
    parseResourceAttributes(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.MedicationStatusCodes.NULL, new Medication.MedicationStatusCodesEnumFactory()));
    } 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(parseRatio(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
      res.getIngredient().add(parseMedicationIngredientComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("batch")) {
      res.setBatch(parseMedicationBatchComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationIngredientComponentContent(int eventType, XmlPullParser xpp, Medication.MedicationIngredientComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.setItem(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isActive")) {
      res.setIsActiveElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "strength")) {
      res.setStrength(parseType("strength", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationBatchComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("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, MedicationAdministration.MedicationAdministrationStatusCodes.NULL, new MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory()));
    } 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.getCategory().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medication")) {
      res.setMedication(parseCodeableReference(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 && nameIsTypeName(xpp, "occurence")) {
      res.setOccurence(parseType("occurence", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorded")) {
      res.setRecordedElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
      res.getPerformer().add(parseMedicationAdministrationPerformerComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
      res.getReason().add(parseCodeableReference(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(parseMedicationAdministrationDosageComponent(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 MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationPerformerComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationAdministrationPerformerComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationAdministrationPerformerComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationAdministrationDosageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationAdministrationDosageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationAdministrationDosageComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("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, MedicationDispense.MedicationDispenseStatusCodes.NULL, new MedicationDispense.MedicationDispenseStatusCodesEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
      res.setStatusReason(parseCodeableReference(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("medication")) {
      res.setMedication(parseCodeableReference(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("performer")) {
      res.getPerformer().add(parseMedicationDispensePerformerComponent(xpp));
    } 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("renderedDosageInstruction")) {
      res.setRenderedDosageInstructionElement(parseString(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(parseMedicationDispenseSubstitutionComponent(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 MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispensePerformerComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationDispensePerformerComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationDispensePerformerComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationDispenseSubstitutionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationDispenseSubstitutionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationDispenseSubstitutionComponentContent(int eventType, XmlPullParser xpp, 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.setResponsibleParty(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();
    parseResourceAttributes(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("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, MedicationKnowledge.MedicationKnowledgeStatusCodes.NULL, new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory()));
    } 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(parseMedicationKnowledgeRelatedMedicationKnowledgeComponent(xpp));
    } 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(parseMedicationKnowledgeMonographComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
      res.getIngredient().add(parseMedicationKnowledgeIngredientComponent(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("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(parseMedicationKnowledgeCostComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monitoringProgram")) {
      res.getMonitoringProgram().add(parseMedicationKnowledgeMonitoringProgramComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("administrationGuideline")) {
      res.getAdministrationGuideline().add(parseMedicationKnowledgeAdministrationGuidelineComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medicineClassification")) {
      res.getMedicineClassification().add(parseMedicationKnowledgeMedicineClassificationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packaging")) {
      res.setPackaging(parseMedicationKnowledgePackagingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("drugCharacteristic")) {
      res.getDrugCharacteristic().add(parseMedicationKnowledgeDrugCharacteristicComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("clinicalUseIssue")) {
      res.getClinicalUseIssue().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("regulatory")) {
      res.getRegulatory().add(parseMedicationKnowledgeRegulatoryComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kineticCharacteristic")) {
      res.getKineticCharacteristic().add(parseMedicationKnowledgeKineticCharacteristicComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationKnowledgeRelatedMedicationKnowledgeComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationKnowledgeMonographComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeMonographComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMonographComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationKnowledgeIngredientComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeIngredientComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeIngredientComponentContent(int eventType, XmlPullParser xpp, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.setItem(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isActive")) {
      res.setIsActiveElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "strength")) {
      res.setStrength(parseType("strength", xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationKnowledgeCostComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationKnowledgeMonitoringProgramComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeMonitoringProgramComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMonitoringProgramComponentContent(int eventType, XmlPullParser xpp, 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.MedicationKnowledgeAdministrationGuidelineComponent parseMedicationKnowledgeAdministrationGuidelineComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeAdministrationGuidelineComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeAdministrationGuidelineComponentContent(int eventType, XmlPullParser xpp, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosage")) {
      res.getDosage().add(parseMedicationKnowledgeAdministrationGuidelineDosageComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indication")) {
      res.setIndication(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientCharacteristic")) {
      res.getPatientCharacteristic().add(parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationKnowledgeAdministrationGuidelineDosageComponentContent(int eventType, XmlPullParser xpp, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent 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.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentContent(int eventType, XmlPullParser xpp, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent 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.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicineClassificationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeMedicineClassificationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeMedicineClassificationComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationKnowledgePackagingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgePackagingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgePackagingComponentContent(int eventType, XmlPullParser xpp, 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
      res.setDevice(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("material")) {
      res.setMaterial(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("packaging")) {
      res.getPackaging().add(parseMedicationKnowledgePackagingComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationKnowledgeDrugCharacteristicComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationKnowledgeRegulatoryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeRegulatoryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeRegulatoryComponentContent(int eventType, XmlPullParser xpp, 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(parseMedicationKnowledgeRegulatorySubstitutionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
      res.getSchedule().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDispense")) {
      res.setMaxDispense(parseMedicationKnowledgeRegulatoryMaxDispenseComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationKnowledgeRegulatorySubstitutionComponentContent(int eventType, XmlPullParser xpp, 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.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeRegulatoryMaxDispenseComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeRegulatoryMaxDispenseComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeRegulatoryMaxDispenseComponentContent(int eventType, XmlPullParser xpp, 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.MedicationKnowledgeKineticCharacteristicComponent parseMedicationKnowledgeKineticCharacteristicComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationKnowledgeKineticCharacteristicComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationKnowledgeKineticCharacteristicComponentContent(int eventType, XmlPullParser xpp, MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent 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 MedicationRequest parseMedicationRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationRequest res = new MedicationRequest();
    parseResourceAttributes(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, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
      res.setDoNotPerformElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reported")) {
      res.setReportedElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationSource")) {
      res.setInformationSource(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medication")) {
      res.setMedication(parseCodeableReference(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("reason")) {
      res.getReason().add(parseCodeableReference(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("renderedDosageInstruction")) {
      res.setRenderedDosageInstructionElement(parseString(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(parseMedicationRequestDispenseRequestComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substitution")) {
      res.setSubstitution(parseMedicationRequestSubstitutionComponent(xpp));
    } 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 parseMedicationRequestDispenseRequestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationRequestDispenseRequestComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationRequestDispenseRequestComponentContent(int eventType, XmlPullParser xpp, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("initialFill")) {
      res.setInitialFill(parseMedicationRequestDispenseRequestInitialFillComponent(xpp));
    } 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("dispenser")) {
      res.setDispenser(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicationRequestDispenseRequestInitialFillComponentContent(int eventType, XmlPullParser xpp, 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 parseMedicationRequestSubstitutionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationRequestSubstitutionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationRequestSubstitutionComponentContent(int eventType, XmlPullParser xpp, 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 MedicationUsage parseMedicationUsage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicationUsage res = new MedicationUsage();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicationUsageContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicationUsageContent(int eventType, XmlPullParser xpp, MedicationUsage 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, MedicationUsage.MedicationUsageStatusCodes.NULL, new MedicationUsage.MedicationUsageStatusCodesEnumFactory()));
    } 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.getCategory().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medication")) {
      res.setMedication(parseCodeableReference(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("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("reason")) {
      res.getReason().add(parseCodeableReference(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("renderedDosageInstruction")) {
      res.setRenderedDosageInstructionElement(parseString(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("takenAsOrdered")) {
      res.setTakenAsOrderedElement(parseBoolean(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicinalProductDefinitionContent(int eventType, XmlPullParser xpp, MedicinalProductDefinition 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(parseCodeableConcept(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.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("description")) {
      res.setDescriptionElement(parseMarkdown(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("combinedPharmaceuticalDoseForm")) {
      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indication")) {
      res.setIndicationElement(parseMarkdown(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(parseCodeableConcept(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("characteristic")) {
      res.getCharacteristic().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("ingredient")) {
      res.getIngredient().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(parseMedicinalProductDefinitionContactComponent(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(parseMedicinalProductDefinitionNameComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("crossReference")) {
      res.getCrossReference().add(parseMedicinalProductDefinitionCrossReferenceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manufacturingBusinessOperation")) {
      res.getManufacturingBusinessOperation().add(parseMedicinalProductDefinitionManufacturingBusinessOperationComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicinalProductDefinitionContactComponentContent(int eventType, XmlPullParser xpp, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent 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("contact")) {
      res.setContact(parseReference(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicinalProductDefinitionNameComponentContent(int eventType, XmlPullParser xpp, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent 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("type")) {
      res.setType(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("namePart")) {
      res.getNamePart().add(parseMedicinalProductDefinitionNameNamePartComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("countryLanguage")) {
      res.getCountryLanguage().add(parseMedicinalProductDefinitionNameCountryLanguageComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicinalProductDefinitionNameNamePartComponentContent(int eventType, XmlPullParser xpp, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent 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(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMedicinalProductDefinitionNameCountryLanguageComponentContent(int eventType, XmlPullParser xpp, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent 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 MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent parseMedicinalProductDefinitionCrossReferenceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicinalProductDefinitionCrossReferenceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductDefinitionCrossReferenceComponentContent(int eventType, XmlPullParser xpp, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "product")) {
      res.setProduct(parseType("product", 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 MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent parseMedicinalProductDefinitionManufacturingBusinessOperationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent res = new MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMedicinalProductDefinitionManufacturingBusinessOperationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMedicinalProductDefinitionManufacturingBusinessOperationComponentContent(int eventType, XmlPullParser xpp, MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setType(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectiveDate")) {
      res.setEffectiveDate(parsePeriod(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("authorization")) {
      res.setAuthorization(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("confidentialityIndicator")) {
      res.setConfidentialityIndicator(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected MessageDefinition parseMessageDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageDefinition res = new MessageDefinition();
    parseResourceAttributes(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(parseMessageDefinitionFocusComponent(xpp));
    } 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(parseMessageDefinitionAllowedResponseComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("graph")) {
      res.getGraph().add(parseCanonical(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMessageDefinitionFocusComponentContent(int eventType, XmlPullParser xpp, 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 parseMessageDefinitionAllowedResponseComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMessageDefinitionAllowedResponseComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageDefinitionAllowedResponseComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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));
    } 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));
    } 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(parseMessageHeaderResponseComponent(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("definition")) {
      res.setDefinitionElement(parseCanonical(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMessageHeaderMessageDestinationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMessageHeaderMessageSourceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageHeaderMessageSourceComponentContent(int eventType, XmlPullParser xpp, 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 parseMessageHeaderResponseComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMessageHeaderResponseComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMessageHeaderResponseComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseMolecularSequenceReferenceSeqComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variant")) {
      res.getVariant().add(parseMolecularSequenceVariantComponent(xpp));
    } 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(parseMolecularSequenceQualityComponent(xpp));
    } 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(parseMolecularSequenceRepositoryComponent(xpp));
    } 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(parseMolecularSequenceStructureVariantComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMolecularSequenceReferenceSeqComponentContent(int eventType, XmlPullParser xpp, 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 parseMolecularSequenceVariantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceVariantComponent res = new MolecularSequence.MolecularSequenceVariantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMolecularSequenceVariantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceVariantComponentContent(int eventType, XmlPullParser xpp, 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 parseMolecularSequenceQualityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceQualityComponent res = new MolecularSequence.MolecularSequenceQualityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMolecularSequenceQualityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceQualityComponentContent(int eventType, XmlPullParser xpp, 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(parseMolecularSequenceQualityRocComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMolecularSequenceQualityRocComponentContent(int eventType, XmlPullParser xpp, 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 parseMolecularSequenceRepositoryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceRepositoryComponent res = new MolecularSequence.MolecularSequenceRepositoryComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMolecularSequenceRepositoryComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceRepositoryComponentContent(int eventType, XmlPullParser xpp, 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 parseMolecularSequenceStructureVariantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceStructureVariantComponent res = new MolecularSequence.MolecularSequenceStructureVariantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMolecularSequenceStructureVariantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceStructureVariantComponentContent(int eventType, XmlPullParser xpp, 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(parseMolecularSequenceStructureVariantOuterComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inner")) {
      res.setInner(parseMolecularSequenceStructureVariantInnerComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseMolecularSequenceStructureVariantOuterComponentContent(int eventType, XmlPullParser xpp, 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 parseMolecularSequenceStructureVariantInnerComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    MolecularSequence.MolecularSequenceStructureVariantInnerComponent res = new MolecularSequence.MolecularSequenceStructureVariantInnerComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseMolecularSequenceStructureVariantInnerComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseMolecularSequenceStructureVariantInnerComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("url")) {
      res.setUrlElement(parseUri(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
      res.setVersionElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
      res.setNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
      res.setKindElement(parseEnumeration(xpp, 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(parseNamingSystemUniqueIdComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseNamingSystemUniqueIdComponentContent(int eventType, XmlPullParser xpp, 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 NutritionIntake parseNutritionIntake(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionIntake res = new NutritionIntake();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionIntakeContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionIntakeContent(int eventType, XmlPullParser xpp, NutritionIntake 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, Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
      res.getStatusReason().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, "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 && nameIsTypeName(xpp, "reported")) {
      res.setReported(parseType("reported", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("consumedItem")) {
      res.getConsumedItem().add(parseNutritionIntakeConsumedItemComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredientLabel")) {
      res.getIngredientLabel().add(parseNutritionIntakeIngredientLabelComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
      res.getPerformer().add(parseNutritionIntakePerformerComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
      res.setLocation(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("reason")) {
      res.getReason().add(parseCodeableReference(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 NutritionIntake.NutritionIntakeConsumedItemComponent parseNutritionIntakeConsumedItemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionIntake.NutritionIntakeConsumedItemComponent res = new NutritionIntake.NutritionIntakeConsumedItemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionIntakeConsumedItemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionIntakeConsumedItemComponentContent(int eventType, XmlPullParser xpp, NutritionIntake.NutritionIntakeConsumedItemComponent 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("nutritionProduct")) {
      res.setNutritionProduct(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("schedule")) {
      res.setSchedule(parseTiming(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.setAmount(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rate")) {
      res.setRate(parseQuantity(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notConsumed")) {
      res.setNotConsumedElement(parseBoolean(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notConsumedReason")) {
      res.setNotConsumedReason(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseNutritionIntakeIngredientLabelComponentContent(int eventType, XmlPullParser xpp, NutritionIntake.NutritionIntakeIngredientLabelComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nutrient")) {
      res.setNutrient(parseCodeableReference(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 NutritionIntake.NutritionIntakePerformerComponent parseNutritionIntakePerformerComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionIntake.NutritionIntakePerformerComponent res = new NutritionIntake.NutritionIntakePerformerComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionIntakePerformerComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionIntakePerformerComponentContent(int eventType, XmlPullParser xpp, NutritionIntake.NutritionIntakePerformerComponent 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 NutritionOrder parseNutritionOrder(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder res = new NutritionOrder();
    parseResourceAttributes(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, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntentElement(parseEnumeration(xpp, Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
    } 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(parseNutritionOrderOralDietComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplement")) {
      res.getSupplement().add(parseNutritionOrderSupplementComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enteralFormula")) {
      res.setEnteralFormula(parseNutritionOrderEnteralFormulaComponent(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 NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderOralDietComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionOrderOralDietComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderOralDietComponentContent(int eventType, XmlPullParser xpp, 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(parseNutritionOrderOralDietNutrientComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("texture")) {
      res.getTexture().add(parseNutritionOrderOralDietTextureComponent(xpp));
    } 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 parseNutritionOrderOralDietNutrientComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionOrderOralDietNutrientComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderOralDietNutrientComponentContent(int eventType, XmlPullParser xpp, 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 parseNutritionOrderOralDietTextureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionOrderOralDietTextureComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderOralDietTextureComponentContent(int eventType, XmlPullParser xpp, 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 parseNutritionOrderSupplementComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionOrderSupplementComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderSupplementComponentContent(int eventType, XmlPullParser xpp, 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 parseNutritionOrderEnteralFormulaComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionOrderEnteralFormulaComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderEnteralFormulaComponentContent(int eventType, XmlPullParser xpp, 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(parseNutritionOrderEnteralFormulaAdministrationComponent(xpp));
    } 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 parseNutritionOrderEnteralFormulaAdministrationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionOrderEnteralFormulaAdministrationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionOrderEnteralFormulaAdministrationComponentContent(int eventType, XmlPullParser xpp, 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 NutritionProduct parseNutritionProduct(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionProduct res = new NutritionProduct();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionProductContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionProductContent(int eventType, XmlPullParser xpp, NutritionProduct res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, NutritionProduct.NutritionProductStatus.NULL, new NutritionProduct.NutritionProductStatusEnumFactory()));
    } 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("manufacturer")) {
      res.getManufacturer().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nutrient")) {
      res.getNutrient().add(parseNutritionProductNutrientComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
      res.getIngredient().add(parseNutritionProductIngredientComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("knownAllergen")) {
      res.getKnownAllergen().add(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productCharacteristic")) {
      res.getProductCharacteristic().add(parseNutritionProductProductCharacteristicComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
      res.setInstance(parseNutritionProductInstanceComponent(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 NutritionProduct.NutritionProductNutrientComponent parseNutritionProductNutrientComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionProduct.NutritionProductNutrientComponent res = new NutritionProduct.NutritionProductNutrientComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionProductNutrientComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionProductNutrientComponentContent(int eventType, XmlPullParser xpp, NutritionProduct.NutritionProductNutrientComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.setItem(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.getAmount().add(parseRatio(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseNutritionProductIngredientComponentContent(int eventType, XmlPullParser xpp, NutritionProduct.NutritionProductIngredientComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.setItem(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
      res.getAmount().add(parseRatio(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseNutritionProductProductCharacteristicComponentContent(int eventType, XmlPullParser xpp, NutritionProduct.NutritionProductProductCharacteristicComponent 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 NutritionProduct.NutritionProductInstanceComponent parseNutritionProductInstanceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    NutritionProduct.NutritionProductInstanceComponent res = new NutritionProduct.NutritionProductInstanceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseNutritionProductInstanceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseNutritionProductInstanceComponentContent(int eventType, XmlPullParser xpp, NutritionProduct.NutritionProductInstanceComponent 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("identifier")) {
      res.getIdentifier().add(parseIdentifier(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lotNumber")) {
      res.setLotNumberElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expiry")) {
      res.setExpiryElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useBy")) {
      res.setUseByElement(parseDateTime(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Observation parseObservation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Observation res = new Observation();
    parseResourceAttributes(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, Enumerations.ObservationStatus.NULL, new Enumerations.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(parseObservationReferenceRangeComponent(xpp));
    } 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(parseObservationComponentComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseObservationReferenceRangeComponentContent(int eventType, XmlPullParser xpp, 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 parseObservationComponentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseObservationComponentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationComponentComponentContent(int eventType, XmlPullParser xpp, 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(parseObservationReferenceRangeComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ObservationDefinition parseObservationDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ObservationDefinition res = new ObservationDefinition();
    parseResourceAttributes(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("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("title")) {
      res.setTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivedFromCanonical")) {
      res.getDerivedFromCanonical().add(parseCanonical(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("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.setPublisher(parseReference(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("performerType")) {
      res.setPerformerType(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("code")) {
      res.setCode(parseCodeableConcept(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("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("preferredReportName")) {
      res.setPreferredReportNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantitativeDetails")) {
      res.setQuantitativeDetails(parseObservationDefinitionQuantitativeDetailsComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualifiedInterval")) {
      res.getQualifiedInterval().add(parseObservationDefinitionQualifiedIntervalComponent(xpp));
    } 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasMember")) {
      res.getHasMember().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("component")) {
      res.getComponent().add(parseObservationDefinitionComponentComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseObservationDefinitionQuantitativeDetailsComponentContent(int eventType, XmlPullParser xpp, 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 parseObservationDefinitionQualifiedIntervalComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseObservationDefinitionQualifiedIntervalComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationDefinitionQualifiedIntervalComponentContent(int eventType, XmlPullParser xpp, 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 ObservationDefinition.ObservationDefinitionComponentComponent parseObservationDefinitionComponentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ObservationDefinition.ObservationDefinitionComponentComponent res = new ObservationDefinition.ObservationDefinitionComponentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseObservationDefinitionComponentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseObservationDefinitionComponentComponentContent(int eventType, XmlPullParser xpp, ObservationDefinition.ObservationDefinitionComponentComponent 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("permittedDataType")) {
      res.getPermittedDataType().add(parseEnumeration(xpp, ObservationDefinition.ObservationDataType.NULL, new ObservationDefinition.ObservationDataTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantitativeDetails")) {
      res.setQuantitativeDetails(parseObservationDefinitionQuantitativeDetailsComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualifiedInterval")) {
      res.getQualifiedInterval().add(parseObservationDefinitionQualifiedIntervalComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected OperationDefinition parseOperationDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationDefinition res = new OperationDefinition();
    parseResourceAttributes(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(parseOperationDefinitionParameterComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("overload")) {
      res.getOverload().add(parseOperationDefinitionOverloadComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseOperationDefinitionParameterComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.OperationParameterUse.NULL, new Enumerations.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(parseEnumeration(xpp, Enumerations.FHIRAllTypes.NULL, new Enumerations.FHIRAllTypesEnumFactory()));
    } 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(parseOperationDefinitionParameterBindingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referencedFrom")) {
      res.getReferencedFrom().add(parseOperationDefinitionParameterReferencedFromComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("part")) {
      res.getPart().add(parseOperationDefinitionParameterComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseOperationDefinitionParameterBindingComponentContent(int eventType, XmlPullParser xpp, 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 parseOperationDefinitionParameterReferencedFromComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseOperationDefinitionParameterReferencedFromComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationDefinitionParameterReferencedFromComponentContent(int eventType, XmlPullParser xpp, 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 parseOperationDefinitionOverloadComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseOperationDefinitionOverloadComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOperationDefinitionOverloadComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseOperationOutcomeIssueComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseOperationOutcomeIssueComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseOrganizationContactComponent(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 Organization.OrganizationContactComponent parseOrganizationContactComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseOrganizationContactComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseOrganizationContactComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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 PackagedProductDefinition parsePackagedProductDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PackagedProductDefinition res = new PackagedProductDefinition();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePackagedProductDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePackagedProductDefinitionContent(int eventType, XmlPullParser xpp, PackagedProductDefinition 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.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("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("description")) {
      res.setDescriptionElement(parseMarkdown(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("characteristic")) {
      res.getCharacteristic().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copackagedIndicator")) {
      res.setCopackagedIndicatorElement(parseBoolean(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(parsePackagedProductDefinitionBatchIdentifierComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("package")) {
      res.getPackage().add(parsePackagedProductDefinitionPackageComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePackagedProductDefinitionBatchIdentifierComponentContent(int eventType, XmlPullParser xpp, PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent 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 PackagedProductDefinition.PackagedProductDefinitionPackageComponent parsePackagedProductDefinitionPackageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PackagedProductDefinition.PackagedProductDefinitionPackageComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePackagedProductDefinitionPackageComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePackagedProductDefinitionPackageComponentContent(int eventType, XmlPullParser xpp, PackagedProductDefinition.PackagedProductDefinitionPackageComponent 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.setQuantityElement(parseInteger(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("shelfLifeStorage")) {
      res.getShelfLifeStorage().add(parseProductShelfLife(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("property")) {
      res.getProperty().add(parsePackagedProductDefinitionPackagePropertyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("containedItem")) {
      res.getContainedItem().add(parsePackagedProductDefinitionPackageContainedItemComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("package")) {
      res.getPackage().add(parsePackagedProductDefinitionPackageComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePackagedProductDefinitionPackagePropertyComponentContent(int eventType, XmlPullParser xpp, PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent 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 PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent parsePackagedProductDefinitionPackageContainedItemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res = new PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePackagedProductDefinitionPackageContainedItemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePackagedProductDefinitionPackageContainedItemComponentContent(int eventType, XmlPullParser xpp, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseReference(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 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(parseParametersParameterComponent(xpp));
    } else if (!parseResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseParametersParameterComponentContent(int eventType, XmlPullParser xpp, 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(parseParametersParameterComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Patient parsePatient(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient res = new Patient();
    parseResourceAttributes(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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("communication")) {
      res.getCommunication().add(parsePatientCommunicationComponent(xpp));
    } 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(parsePatientLinkComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePatientContactComponentContent(int eventType, XmlPullParser xpp, 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 parsePatientCommunicationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePatientCommunicationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePatientCommunicationComponentContent(int eventType, XmlPullParser xpp, 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 parsePatientLinkComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePatientLinkComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePatientLinkComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
    } 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));
    } 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));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePaymentReconciliationDetailsComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePaymentReconciliationNotesComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePaymentReconciliationNotesComponentContent(int eventType, XmlPullParser xpp, 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 Permission parsePermission(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Permission res = new Permission();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePermissionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePermissionContent(int eventType, XmlPullParser xpp, Permission res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, Permission.PermissionStatus.NULL, new Permission.PermissionStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntent(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("asserter")) {
      res.setAsserter(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assertionDate")) {
      res.getAssertionDate().add(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validity")) {
      res.setValidity(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
      res.getPurpose().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dataScope")) {
      res.getDataScope().add(parseExpression(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processingActivity")) {
      res.getProcessingActivity().add(parsePermissionProcessingActivityComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("justification")) {
      res.setJustification(parsePermissionJustificationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usageLimitations")) {
      res.getUsageLimitations().add(parseCodeableConcept(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePermissionProcessingActivityComponentContent(int eventType, XmlPullParser xpp, Permission.PermissionProcessingActivityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partyReference")) {
      res.getPartyReference().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partyCodeableConcept")) {
      res.getPartyCodeableConcept().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
      res.getPurpose().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePermissionJustificationComponentContent(int eventType, XmlPullParser xpp, Permission.PermissionJustificationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("evidence")) {
      res.getEvidence().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("grounds")) {
      res.getGrounds().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Person parsePerson(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Person res = new Person();
    parseResourceAttributes(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(parsePersonLinkComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePersonLinkComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parsePlanDefinitionGoalComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parsePlanDefinitionActionComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePlanDefinitionGoalComponentContent(int eventType, XmlPullParser xpp, 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(parsePlanDefinitionGoalTargetComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePlanDefinitionGoalTargetComponentContent(int eventType, XmlPullParser xpp, 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 parsePlanDefinitionActionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePlanDefinitionActionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionActionComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.RequestPriority.NULL, new Enumerations.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(parsePlanDefinitionActionConditionComponent(xpp));
    } 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(parsePlanDefinitionActionRelatedActionComponent(xpp));
    } 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(parsePlanDefinitionActionParticipantComponent(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, Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("selectionBehavior")) {
      res.setSelectionBehaviorElement(parseEnumeration(xpp, Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requiredBehavior")) {
      res.setRequiredBehaviorElement(parseEnumeration(xpp, Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precheckBehavior")) {
      res.setPrecheckBehaviorElement(parseEnumeration(xpp, Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cardinalityBehavior")) {
      res.setCardinalityBehaviorElement(parseEnumeration(xpp, Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.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(parsePlanDefinitionActionDynamicValueComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parsePlanDefinitionActionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parsePlanDefinitionActionConditionComponentContent(int eventType, XmlPullParser xpp, PlanDefinition.PlanDefinitionActionConditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
      res.setKindElement(parseEnumeration(xpp, Enumerations.ActionConditionKind.NULL, new Enumerations.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 parsePlanDefinitionActionRelatedActionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePlanDefinitionActionRelatedActionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionActionRelatedActionComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.ActionRelationshipType.NULL, new Enumerations.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 parsePlanDefinitionActionParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePlanDefinitionActionParticipantComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionActionParticipantComponentContent(int eventType, XmlPullParser xpp, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(parseEnumeration(xpp, Enumerations.ActionParticipantType.NULL, new Enumerations.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 parsePlanDefinitionActionDynamicValueComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePlanDefinitionActionDynamicValueComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePlanDefinitionActionDynamicValueComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parsePractitionerQualificationComponent(xpp));
    } 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 parsePractitionerQualificationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePractitionerQualificationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerQualificationComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parsePractitionerRoleAvailableTimeComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notAvailable")) {
      res.getNotAvailable().add(parsePractitionerRoleNotAvailableComponent(xpp));
    } 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 parsePractitionerRoleAvailableTimeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePractitionerRoleAvailableTimeComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerRoleAvailableTimeComponentContent(int eventType, XmlPullParser xpp, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysOfWeek")) {
      res.getDaysOfWeek().add(parseEnumeration(xpp, Enumerations.DaysOfWeek.NULL, new Enumerations.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 parsePractitionerRoleNotAvailableComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parsePractitionerRoleNotAvailableComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parsePractitionerRoleNotAvailableComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
    } 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("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("recorded")) {
      res.setRecordedElement(parseDateTime(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorder")) {
      res.setRecorder(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reported")) {
      res.setReported(parseType("reported", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
      res.getPerformer().add(parseProcedurePerformerComponent(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(parseCodeableReference(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(parseProcedureFocalDeviceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("used")) {
      res.getUsed().add(parseCodeableReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseProcedurePerformerComponentContent(int eventType, XmlPullParser xpp, 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 parseProcedureFocalDeviceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseProcedureFocalDeviceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProcedureFocalDeviceComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseProvenanceAgentComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entity")) {
      res.getEntity().add(parseProvenanceEntityComponent(xpp));
    } 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 parseProvenanceAgentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseProvenanceAgentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProvenanceAgentComponentContent(int eventType, XmlPullParser xpp, 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 parseProvenanceEntityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseProvenanceEntityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseProvenanceEntityComponentContent(int eventType, XmlPullParser xpp, 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(parseProvenanceAgentComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected Questionnaire parseQuestionnaire(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Questionnaire res = new Questionnaire();
    parseResourceAttributes(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(parseQuestionnaireItemComponent(xpp));
    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseQuestionnaireItemComponentContent(int eventType, XmlPullParser xpp, 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(parseQuestionnaireItemEnableWhenComponent(xpp));
    } 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(parseQuestionnaireItemAnswerOptionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("initial")) {
      res.getInitial().add(parseQuestionnaireItemInitialComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseQuestionnaireItemComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseQuestionnaireItemEnableWhenComponentContent(int eventType, XmlPullParser xpp, 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 parseQuestionnaireItemAnswerOptionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseQuestionnaireItemAnswerOptionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireItemAnswerOptionComponentContent(int eventType, XmlPullParser xpp, 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 parseQuestionnaireItemInitialComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseQuestionnaireItemInitialComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseQuestionnaireItemInitialComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseQuestionnaireResponseItemComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseQuestionnaireResponseItemComponentContent(int eventType, XmlPullParser xpp, 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(parseQuestionnaireResponseItemAnswerComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.getItem().add(parseQuestionnaireResponseItemComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseQuestionnaireResponseItemAnswerComponentContent(int eventType, XmlPullParser xpp, 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(parseQuestionnaireResponseItemComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseRegulatedAuthorizationContent(int eventType, XmlPullParser xpp, RegulatedAuthorization 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("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("region")) {
      res.getRegion().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("validityPeriod")) {
      res.setValidityPeriod(parsePeriod(xpp));
    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "indication")) {
      res.setIndication(parseType("indication", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intendedUse")) {
      res.setIntendedUse(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basis")) {
      res.getBasis().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedDate")) {
      res.getRelatedDate().add(parseRegulatedAuthorizationRelatedDateComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdictionalAuthorization")) {
      res.getJurisdictionalAuthorization().add(parseReference(xpp));
    } 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("case")) {
      res.setCase(parseRegulatedAuthorizationCaseComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseRegulatedAuthorizationRelatedDateComponentContent(int eventType, XmlPullParser xpp, RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "date")) {
      res.setDate(parseType("date", 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 RegulatedAuthorization.RegulatedAuthorizationCaseComponent parseRegulatedAuthorizationCaseComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RegulatedAuthorization.RegulatedAuthorizationCaseComponent res = new RegulatedAuthorization.RegulatedAuthorizationCaseComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseRegulatedAuthorizationCaseComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

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

  protected RelatedPerson parseRelatedPerson(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RelatedPerson res = new RelatedPerson();
    parseResourceAttributes(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(parseRelatedPersonCommunicationComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseRelatedPersonCommunicationComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntentElement(parseEnumeration(xpp, Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
      res.setPriorityElement(parseEnumeration(xpp, Enumerations.RequestPriority.NULL, new Enumerations.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("reason")) {
      res.getReason().add(parseCodeableReference(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(parseRequestGroupActionComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseRequestGroupActionComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.RequestPriority.NULL, new Enumerations.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(parseRequestGroupActionConditionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedAction")) {
      res.getRelatedAction().add(parseRequestGroupActionRelatedActionComponent(xpp));
    } 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, Enumerations.ActionGroupingBehavior.NULL, new Enumerations.ActionGroupingBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("selectionBehavior")) {
      res.setSelectionBehaviorElement(parseEnumeration(xpp, Enumerations.ActionSelectionBehavior.NULL, new Enumerations.ActionSelectionBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requiredBehavior")) {
      res.setRequiredBehaviorElement(parseEnumeration(xpp, Enumerations.ActionRequiredBehavior.NULL, new Enumerations.ActionRequiredBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precheckBehavior")) {
      res.setPrecheckBehaviorElement(parseEnumeration(xpp, Enumerations.ActionPrecheckBehavior.NULL, new Enumerations.ActionPrecheckBehaviorEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cardinalityBehavior")) {
      res.setCardinalityBehaviorElement(parseEnumeration(xpp, Enumerations.ActionCardinalityBehavior.NULL, new Enumerations.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(parseRequestGroupActionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseRequestGroupActionConditionComponentContent(int eventType, XmlPullParser xpp, RequestGroup.RequestGroupActionConditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
      res.setKindElement(parseEnumeration(xpp, Enumerations.ActionConditionKind.NULL, new Enumerations.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 parseRequestGroupActionRelatedActionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseRequestGroupActionRelatedActionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRequestGroupActionRelatedActionComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.ActionRelationshipType.NULL, new Enumerations.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 ResearchStudy parseResearchStudy(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchStudy res = new ResearchStudy();
    parseResourceAttributes(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(parseResearchStudyArmComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("objective")) {
      res.getObjective().add(parseResearchStudyObjectiveComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseResearchStudyArmComponentContent(int eventType, XmlPullParser xpp, 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 parseResearchStudyObjectiveComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseResearchStudyObjectiveComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseResearchStudyObjectiveComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("progress")) {
      res.getProgress().add(parseResearchSubjectProgressComponent(xpp));
    } 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 ResearchSubject.ResearchSubjectProgressComponent parseResearchSubjectProgressComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ResearchSubject.ResearchSubjectProgressComponent res = new ResearchSubject.ResearchSubjectProgressComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseResearchSubjectProgressComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseResearchSubjectProgressComponentContent(int eventType, XmlPullParser xpp, ResearchSubject.ResearchSubjectProgressComponent 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("state")) {
      res.setState(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("milestone")) {
      res.setMilestone(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("startDate")) {
      res.setStartDateElement(parseDateTime(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected RiskAssessment parseRiskAssessment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskAssessment res = new RiskAssessment();
    parseResourceAttributes(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, Enumerations.ObservationStatus.NULL, new Enumerations.ObservationStatusEnumFactory()));
    } 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("reason")) {
      res.getReason().add(parseCodeableReference(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(parseRiskAssessmentPredictionComponent(xpp));
    } 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 parseRiskAssessmentPredictionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseRiskAssessmentPredictionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseRiskAssessmentPredictionComponentContent(int eventType, XmlPullParser xpp, 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 Schedule parseSchedule(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Schedule res = new Schedule();
    parseResourceAttributes(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();
    parseResourceAttributes(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(parseSearchParameterComponentComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSearchParameterComponentComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
      res.setIntentElement(parseEnumeration(xpp, Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
    } 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, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
    } 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("location")) {
      res.getLocation().add(parseCodeableReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
      res.getReason().add(parseCodeableReference(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();
    parseResourceAttributes(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();
    parseResourceAttributes(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(parseSpecimenCollectionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processing")) {
      res.getProcessing().add(parseSpecimenProcessingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("container")) {
      res.getContainer().add(parseSpecimenContainerComponent(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("note")) {
      res.getNote().add(parseAnnotation(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSpecimenCollectionComponentContent(int eventType, XmlPullParser xpp, 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 parseSpecimenProcessingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSpecimenProcessingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenProcessingComponentContent(int eventType, XmlPullParser xpp, 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 parseSpecimenContainerComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSpecimenContainerComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenContainerComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("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("title")) {
      res.setTitleElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivedFromCanonical")) {
      res.getDerivedFromCanonical().add(parseCanonical(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("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.setPublisher(parseReference(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("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(parseSpecimenDefinitionTypeTestedComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSpecimenDefinitionTypeTestedComponentContent(int eventType, XmlPullParser xpp, 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(parseSpecimenDefinitionTypeTestedContainerComponent(xpp));
    } 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("singleUse")) {
      res.setSingleUseElement(parseBoolean(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(parseSpecimenDefinitionTypeTestedHandlingComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("testingDestination")) {
      res.getTestingDestination().add(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSpecimenDefinitionTypeTestedContainerComponentContent(int eventType, XmlPullParser xpp, 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(parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(xpp));
    } 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 parseSpecimenDefinitionTypeTestedContainerAdditiveComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSpecimenDefinitionTypeTestedContainerAdditiveComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenDefinitionTypeTestedContainerAdditiveComponentContent(int eventType, XmlPullParser xpp, 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 parseSpecimenDefinitionTypeTestedHandlingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSpecimenDefinitionTypeTestedHandlingComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSpecimenDefinitionTypeTestedHandlingComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseStructureDefinitionMappingComponent(xpp));
    } 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(parseStructureDefinitionContextComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contextInvariant")) {
      res.getContextInvariant().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
      res.setTypeElement(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(parseStructureDefinitionSnapshotComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("differential")) {
      res.setDifferential(parseStructureDefinitionDifferentialComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStructureDefinitionMappingComponentContent(int eventType, XmlPullParser xpp, 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 parseStructureDefinitionContextComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureDefinitionContextComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionContextComponentContent(int eventType, XmlPullParser xpp, 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 parseStructureDefinitionSnapshotComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureDefinitionSnapshotComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionSnapshotComponentContent(int eventType, XmlPullParser xpp, 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 parseStructureDefinitionDifferentialComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureDefinitionDifferentialComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureDefinitionDifferentialComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseStructureMapStructureComponent(xpp));
    } 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(parseStructureMapGroupComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStructureMapStructureComponentContent(int eventType, XmlPullParser xpp, 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 parseStructureMapGroupComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureMapGroupComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapGroupComponentContent(int eventType, XmlPullParser xpp, 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(parseStructureMapGroupInputComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
      res.getRule().add(parseStructureMapGroupRuleComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStructureMapGroupInputComponentContent(int eventType, XmlPullParser xpp, 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 parseStructureMapGroupRuleComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureMapGroupRuleComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapGroupRuleComponentContent(int eventType, XmlPullParser xpp, 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(parseStructureMapGroupRuleSourceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
      res.getTarget().add(parseStructureMapGroupRuleTargetComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rule")) {
      res.getRule().add(parseStructureMapGroupRuleComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependent")) {
      res.getDependent().add(parseStructureMapGroupRuleDependentComponent(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.StructureMapGroupRuleSourceComponent parseStructureMapGroupRuleSourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureMapGroupRuleSourceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapGroupRuleSourceComponentContent(int eventType, XmlPullParser xpp, 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 parseStructureMapGroupRuleTargetComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureMapGroupRuleTargetComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapGroupRuleTargetComponentContent(int eventType, XmlPullParser xpp, 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(parseStructureMapGroupRuleTargetParameterComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseStructureMapGroupRuleTargetParameterComponentContent(int eventType, XmlPullParser xpp, 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 parseStructureMapGroupRuleDependentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseStructureMapGroupRuleDependentComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseStructureMapGroupRuleDependentComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("identifier")) {
      res.getIdentifier().add(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, Enumerations.SubscriptionState.NULL, new Enumerations.SubscriptionStateEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
      res.setTopic(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("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("filterBy")) {
      res.getFilterBy().add(parseSubscriptionFilterByComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
      res.getError().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("channelType")) {
      res.setChannelType(parseCoding(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
      res.setEndpointElement(parseUrl(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("header")) {
      res.getHeader().add(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("heartbeatPeriod")) {
      res.setHeartbeatPeriodElement(parseUnsignedInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timeout")) {
      res.setTimeoutElement(parseUnsignedInt(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
      res.setContentTypeElement(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
      res.setContentElement(parseEnumeration(xpp, Subscription.SubscriptionPayloadContent.NULL, new Subscription.SubscriptionPayloadContentEnumFactory()));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubscriptionFilterByComponentContent(int eventType, XmlPullParser xpp, Subscription.SubscriptionFilterByComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParamName")) {
      res.setSearchParamNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchModifier")) {
      res.setSearchModifierElement(parseEnumeration(xpp, Enumerations.SubscriptionSearchModifier.NULL, new Enumerations.SubscriptionSearchModifierEnumFactory()));
    } 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 SubscriptionStatus parseSubscriptionStatus(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubscriptionStatus res = new SubscriptionStatus();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubscriptionStatusContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubscriptionStatusContent(int eventType, XmlPullParser xpp, SubscriptionStatus res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notificationType")) {
      res.setNotificationTypeElement(parseEnumeration(xpp, SubscriptionStatus.SubscriptionNotificationType.NULL, new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventsSinceSubscriptionStart")) {
      res.setEventsSinceSubscriptionStartElement(parseInteger64(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("eventsInNotification")) {
      res.setEventsInNotificationElement(parseInteger(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subscription")) {
      res.setSubscription(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
      res.setStatusElement(parseEnumeration(xpp, Enumerations.SubscriptionState.NULL, new Enumerations.SubscriptionStateEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
      res.setTopic(parseReference(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubscriptionTopicContent(int eventType, XmlPullParser xpp, SubscriptionTopic 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("derivedFromCanonical")) {
      res.getDerivedFromCanonical().add(parseCanonical(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("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.setPublisher(parseReference(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("resourceTrigger")) {
      res.setResourceTrigger(parseSubscriptionTopicResourceTriggerComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("canFilterBy")) {
      res.getCanFilterBy().add(parseSubscriptionTopicCanFilterByComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubscriptionTopicResourceTriggerComponentContent(int eventType, XmlPullParser xpp, SubscriptionTopic.SubscriptionTopicResourceTriggerComponent 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("resourceType")) {
      res.getResourceType().add(parseCode(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("methodCriteria")) {
      res.getMethodCriteria().add(parseEnumeration(xpp, SubscriptionTopic.InteractionTrigger.NULL, new SubscriptionTopic.InteractionTriggerEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("queryCriteria")) {
      res.setQueryCriteria(parseSubscriptionTopicResourceTriggerQueryCriteriaComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirPathCriteria")) {
      res.getFhirPathCriteria().add(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubscriptionTopicResourceTriggerQueryCriteriaComponentContent(int eventType, XmlPullParser xpp, SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("previous")) {
      res.setPreviousElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("current")) {
      res.setCurrentElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requireBoth")) {
      res.setRequireBothElement(parseBoolean(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubscriptionTopicCanFilterByComponentContent(int eventType, XmlPullParser xpp, SubscriptionTopic.SubscriptionTopicCanFilterByComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParamName")) {
      res.setSearchParamNameElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchModifier")) {
      res.getSearchModifier().add(parseEnumeration(xpp, Enumerations.SubscriptionSearchModifier.NULL, new Enumerations.SubscriptionSearchModifierEnumFactory()));
    } 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 Substance parseSubstance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Substance res = new Substance();
    parseResourceAttributes(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(parseSubstanceInstanceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
      res.getIngredient().add(parseSubstanceIngredientComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceInstanceComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceIngredientComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceIngredientComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceIngredientComponentContent(int eventType, XmlPullParser xpp, 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 SubstanceDefinition parseSubstanceDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition res = new SubstanceDefinition();
    parseResourceAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionContent(int eventType, XmlPullParser xpp, SubstanceDefinition 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("version")) {
      res.setVersionElement(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("category")) {
      res.setCategory(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(parseMarkdown(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("note")) {
      res.getNote().add(parseAnnotation(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("supplier")) {
      res.getSupplier().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("moiety")) {
      res.getMoiety().add(parseSubstanceDefinitionMoietyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseSubstanceDefinitionPropertyComponent(xpp));
    } 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(parseSubstanceDefinitionStructureComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
      res.getCode().add(parseSubstanceDefinitionCodeComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
      res.getName().add(parseSubstanceDefinitionNameComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularWeight")) {
      res.getMolecularWeight().add(parseSubstanceDefinitionStructureIsotopeMolecularWeightComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
      res.getRelationship().add(parseSubstanceDefinitionRelationshipComponent(xpp));
    } 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 SubstanceDefinition.SubstanceDefinitionMoietyComponent parseSubstanceDefinitionMoietyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition.SubstanceDefinitionMoietyComponent res = new SubstanceDefinition.SubstanceDefinitionMoietyComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionMoietyComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionMoietyComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionMoietyComponent 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amountType")) {
      res.setAmountType(parseCodeableConcept(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceDefinitionPropertyComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionPropertyComponent 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 (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referenceRange")) {
      res.setReferenceRange(parseRange(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 SubstanceDefinition.SubstanceDefinitionStructureComponent parseSubstanceDefinitionStructureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition.SubstanceDefinitionStructureComponent res = new SubstanceDefinition.SubstanceDefinitionStructureComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionStructureComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionStructureComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionStructureComponent 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(parseSubstanceDefinitionStructureIsotopeComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("molecularWeight")) {
      res.setMolecularWeight(parseSubstanceDefinitionStructureIsotopeMolecularWeightComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("technique")) {
      res.getTechnique().add(parseCodeableConcept(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceDocument")) {
      res.getSourceDocument().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("representation")) {
      res.getRepresentation().add(parseSubstanceDefinitionStructureRepresentationComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceDefinitionStructureIsotopeComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent 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(parseSubstanceDefinitionStructureIsotopeMolecularWeightComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceDefinitionStructureIsotopeMolecularWeightComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent 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 SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent parseSubstanceDefinitionStructureRepresentationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent res = new SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionStructureRepresentationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionStructureRepresentationComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent 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("format")) {
      res.setFormat(parseCodeableConcept(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 SubstanceDefinition.SubstanceDefinitionCodeComponent parseSubstanceDefinitionCodeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition.SubstanceDefinitionCodeComponent res = new SubstanceDefinition.SubstanceDefinitionCodeComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionCodeComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionCodeComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionCodeComponent 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("note")) {
      res.getNote().add(parseAnnotation(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 SubstanceDefinition.SubstanceDefinitionNameComponent parseSubstanceDefinitionNameComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition.SubstanceDefinitionNameComponent res = new SubstanceDefinition.SubstanceDefinitionNameComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionNameComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionNameComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionNameComponent 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(parseSubstanceDefinitionNameComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("translation")) {
      res.getTranslation().add(parseSubstanceDefinitionNameComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("official")) {
      res.getOfficial().add(parseSubstanceDefinitionNameOfficialComponent(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 SubstanceDefinition.SubstanceDefinitionNameOfficialComponent parseSubstanceDefinitionNameOfficialComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition.SubstanceDefinitionNameOfficialComponent res = new SubstanceDefinition.SubstanceDefinitionNameOfficialComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionNameOfficialComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionNameOfficialComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent 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 SubstanceDefinition.SubstanceDefinitionRelationshipComponent parseSubstanceDefinitionRelationshipComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceDefinition.SubstanceDefinitionRelationshipComponent res = new SubstanceDefinition.SubstanceDefinitionRelationshipComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceDefinitionRelationshipComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceDefinitionRelationshipComponentContent(int eventType, XmlPullParser xpp, SubstanceDefinition.SubstanceDefinitionRelationshipComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "substanceDefinition")) {
      res.setSubstanceDefinition(parseType("substanceDefinition", 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 && nameIsTypeName(xpp, "amount")) {
      res.setAmount(parseType("amount", xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amountRatioHighLimit")) {
      res.setAmountRatioHighLimit(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 SubstanceNucleicAcid parseSubstanceNucleicAcid(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceNucleicAcid res = new SubstanceNucleicAcid();
    parseResourceAttributes(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(parseSubstanceNucleicAcidSubunitComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceNucleicAcidSubunitComponentContent(int eventType, XmlPullParser xpp, 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(parseSubstanceNucleicAcidSubunitLinkageComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sugar")) {
      res.getSugar().add(parseSubstanceNucleicAcidSubunitSugarComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceNucleicAcidSubunitLinkageComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceNucleicAcidSubunitSugarComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent res = new SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceNucleicAcidSubunitSugarComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceNucleicAcidSubunitSugarComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("identifier")) {
      res.setIdentifier(parseIdentifier(xpp));
    } else 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.setModificationElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monomerSet")) {
      res.getMonomerSet().add(parseSubstancePolymerMonomerSetComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeat")) {
      res.getRepeat().add(parseSubstancePolymerRepeatComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstancePolymerMonomerSetComponentContent(int eventType, XmlPullParser xpp, 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(parseSubstancePolymerMonomerSetStartingMaterialComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstancePolymerMonomerSetStartingMaterialComponentContent(int eventType, XmlPullParser xpp, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent 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("category")) {
      res.setCategory(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 parseSubstancePolymerRepeatComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstancePolymerRepeatComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerRepeatComponentContent(int eventType, XmlPullParser xpp, 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(parseSubstancePolymerRepeatRepeatUnitComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstancePolymerRepeatRepeatUnitComponentContent(int eventType, XmlPullParser xpp, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unit")) {
      res.setUnitElement(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orientation")) {
      res.setOrientation(parseCodeableConcept(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(parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("structuralRepresentation")) {
      res.getStructuralRepresentation().add(parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentContent(int eventType, XmlPullParser xpp, 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("format")) {
      res.setFormat(parseCodeableConcept(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();
    parseResourceAttributes(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(parseSubstanceProteinSubunitComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceProteinSubunitComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseSubstanceReferenceInformationGeneComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("geneElement")) {
      res.getGeneElement().add(parseSubstanceReferenceInformationGeneElementComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
      res.getClassification().add(parseSubstanceReferenceInformationClassificationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
      res.getTarget().add(parseSubstanceReferenceInformationTargetComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceReferenceInformationGeneComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceReferenceInformationGeneElementComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceReferenceInformationGeneElementComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceReferenceInformationGeneElementComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceReferenceInformationClassificationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceReferenceInformationClassificationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceReferenceInformationClassificationComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceReferenceInformationTargetComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceReferenceInformationTargetComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceReferenceInformationTargetComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseSubstanceSourceMaterialFractionDescriptionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organism")) {
      res.setOrganism(parseSubstanceSourceMaterialOrganismComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partDescription")) {
      res.getPartDescription().add(parseSubstanceSourceMaterialPartDescriptionComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceSourceMaterialFractionDescriptionComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceSourceMaterialOrganismComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceSourceMaterialOrganismComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialOrganismComponentContent(int eventType, XmlPullParser xpp, 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(parseSubstanceSourceMaterialOrganismAuthorComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hybrid")) {
      res.setHybrid(parseSubstanceSourceMaterialOrganismHybridComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organismGeneral")) {
      res.setOrganismGeneral(parseSubstanceSourceMaterialOrganismOrganismGeneralComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseSubstanceSourceMaterialOrganismAuthorComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceSourceMaterialOrganismHybridComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceSourceMaterialOrganismHybridComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialOrganismHybridComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceSourceMaterialOrganismOrganismGeneralComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceSourceMaterialOrganismOrganismGeneralComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialOrganismOrganismGeneralComponentContent(int eventType, XmlPullParser xpp, 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 parseSubstanceSourceMaterialPartDescriptionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent res = new SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSubstanceSourceMaterialPartDescriptionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSubstanceSourceMaterialPartDescriptionComponentContent(int eventType, XmlPullParser xpp, 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 SupplyDelivery parseSupplyDelivery(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyDelivery res = new SupplyDelivery();
    parseResourceAttributes(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(parseSupplyDeliverySuppliedItemComponent(xpp));
    } 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 parseSupplyDeliverySuppliedItemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSupplyDeliverySuppliedItemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyDeliverySuppliedItemComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
      res.setItem(parseCodeableReference(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(parseSupplyRequestParameterComponent(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("supplier")) {
      res.getSupplier().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
      res.getReason().add(parseCodeableReference(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 parseSupplyRequestParameterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseSupplyRequestParameterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseSupplyRequestParameterComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
    } 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(parseTaskRestrictionComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("input")) {
      res.getInput().add(parseTaskParameterComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("output")) {
      res.getOutput().add(parseTaskOutputComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTaskRestrictionComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    Task.ParameterComponent res = new Task.ParameterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTaskParameterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTaskParameterComponentContent(int eventType, XmlPullParser xpp, 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 parseTaskOutputComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTaskOutputComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTaskOutputComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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("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("kind")) {
      res.setKindElement(parseEnumeration(xpp, Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("software")) {
      res.setSoftware(parseTerminologyCapabilitiesSoftwareComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementation")) {
      res.setImplementation(parseTerminologyCapabilitiesImplementationComponent(xpp));
    } 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(parseTerminologyCapabilitiesCodeSystemComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expansion")) {
      res.setExpansion(parseTerminologyCapabilitiesExpansionComponent(xpp));
    } 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(parseTerminologyCapabilitiesValidateCodeComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("translation")) {
      res.setTranslation(parseTerminologyCapabilitiesTranslationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("closure")) {
      res.setClosure(parseTerminologyCapabilitiesClosureComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTerminologyCapabilitiesSoftwareComponentContent(int eventType, XmlPullParser xpp, 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 parseTerminologyCapabilitiesImplementationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesImplementationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesImplementationComponentContent(int eventType, XmlPullParser xpp, 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 parseTerminologyCapabilitiesCodeSystemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesCodeSystemComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesCodeSystemComponentContent(int eventType, XmlPullParser xpp, 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(parseTerminologyCapabilitiesCodeSystemVersionComponent(xpp));
    } 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 parseTerminologyCapabilitiesCodeSystemVersionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesCodeSystemVersionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesCodeSystemVersionComponentContent(int eventType, XmlPullParser xpp, 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(parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(xpp));
    } 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 parseTerminologyCapabilitiesCodeSystemVersionFilterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesCodeSystemVersionFilterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesCodeSystemVersionFilterComponentContent(int eventType, XmlPullParser xpp, 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 parseTerminologyCapabilitiesExpansionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesExpansionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesExpansionComponentContent(int eventType, XmlPullParser xpp, 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(parseTerminologyCapabilitiesExpansionParameterComponent(xpp));
    } 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 parseTerminologyCapabilitiesExpansionParameterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesExpansionParameterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesExpansionParameterComponentContent(int eventType, XmlPullParser xpp, 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 parseTerminologyCapabilitiesValidateCodeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesValidateCodeComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesValidateCodeComponentContent(int eventType, XmlPullParser xpp, 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 parseTerminologyCapabilitiesTranslationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesTranslationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesTranslationComponentContent(int eventType, XmlPullParser xpp, 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 parseTerminologyCapabilitiesClosureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTerminologyCapabilitiesClosureComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTerminologyCapabilitiesClosureComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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(parseTestReportParticipantComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("setup")) {
      res.setSetup(parseTestReportSetupComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("test")) {
      res.getTest().add(parseTestReportTestComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("teardown")) {
      res.setTeardown(parseTestReportTeardownComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestReportParticipantComponentContent(int eventType, XmlPullParser xpp, 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 parseTestReportSetupComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestReportSetupComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportSetupComponentContent(int eventType, XmlPullParser xpp, TestReport.TestReportSetupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parseTestReportSetupActionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestReportSetupActionComponentContent(int eventType, XmlPullParser xpp, TestReport.SetupActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.setOperation(parseTestReportSetupActionOperationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
      res.setAssert(parseTestReportSetupActionAssertComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestReportSetupActionOperationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestReportSetupActionAssertComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportSetupActionAssertComponentContent(int eventType, XmlPullParser xpp, 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 parseTestReportTestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestReportTestComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestReportTestComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestReportTestActionComponentContent(int eventType, XmlPullParser xpp, TestReport.TestActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.setOperation(parseTestReportSetupActionOperationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
      res.setAssert(parseTestReportSetupActionAssertComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestReportTeardownComponentContent(int eventType, XmlPullParser xpp, TestReport.TestReportTeardownComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parseTestReportTeardownActionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestReportTeardownActionComponentContent(int eventType, XmlPullParser xpp, TestReport.TeardownActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.setOperation(parseTestReportSetupActionOperationComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected TestScript parseTestScript(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript res = new TestScript();
    parseResourceAttributes(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.addIdentifier(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(parseTestScriptOriginComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("destination")) {
      res.getDestination().add(parseTestScriptDestinationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("metadata")) {
      res.setMetadata(parseTestScriptMetadataComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fixture")) {
      res.getFixture().add(parseTestScriptFixtureComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
      res.getProfile().add(parseReference(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("variable")) {
      res.getVariable().add(parseTestScriptVariableComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("setup")) {
      res.setSetup(parseTestScriptSetupComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("test")) {
      res.getTest().add(parseTestScriptTestComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("teardown")) {
      res.setTeardown(parseTestScriptTeardownComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestScriptOriginComponentContent(int eventType, XmlPullParser xpp, 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 parseTestScriptDestinationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptDestinationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptDestinationComponentContent(int eventType, XmlPullParser xpp, 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 parseTestScriptMetadataComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptMetadataComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptMetadataComponentContent(int eventType, XmlPullParser xpp, TestScript.TestScriptMetadataComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
      res.getLink().add(parseTestScriptMetadataLinkComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("capability")) {
      res.getCapability().add(parseTestScriptMetadataCapabilityComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestScriptMetadataLinkComponentContent(int eventType, XmlPullParser xpp, 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 parseTestScriptMetadataCapabilityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptMetadataCapabilityComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptMetadataCapabilityComponentContent(int eventType, XmlPullParser xpp, 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 parseTestScriptFixtureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptFixtureComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptFixtureComponentContent(int eventType, XmlPullParser xpp, 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 parseTestScriptVariableComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptVariableComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptVariableComponentContent(int eventType, XmlPullParser xpp, 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 parseTestScriptSetupComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptSetupComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptSetupComponentContent(int eventType, XmlPullParser xpp, TestScript.TestScriptSetupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parseTestScriptSetupActionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestScriptSetupActionComponentContent(int eventType, XmlPullParser xpp, TestScript.SetupActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.setOperation(parseTestScriptSetupActionOperationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
      res.setAssert(parseTestScriptSetupActionAssertComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestScriptSetupActionOperationComponentContent(int eventType, XmlPullParser xpp, 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(parseEnumeration(xpp, TestScript.FHIRDefinedType.NULL, new TestScript.FHIRDefinedTypeEnumFactory()));
    } 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));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptSetupActionOperationRequestHeaderComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptSetupActionOperationRequestHeaderComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptSetupActionAssertComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptSetupActionAssertComponentContent(int eventType, XmlPullParser xpp, 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(parseEnumeration(xpp, TestScript.FHIRDefinedType.NULL, new TestScript.FHIRDefinedTypeEnumFactory()));
    } 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 parseTestScriptTestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseTestScriptTestComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseTestScriptTestComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestScriptTestActionComponentContent(int eventType, XmlPullParser xpp, TestScript.TestActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.setOperation(parseTestScriptSetupActionOperationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assert")) {
      res.setAssert(parseTestScriptSetupActionAssertComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestScriptTeardownComponentContent(int eventType, XmlPullParser xpp, TestScript.TestScriptTeardownComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
      res.getAction().add(parseTestScriptTeardownActionComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseTestScriptTeardownActionComponentContent(int eventType, XmlPullParser xpp, TestScript.TeardownActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
      res.setOperation(parseTestScriptSetupActionOperationComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

  protected ValueSet parseValueSet(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet res = new ValueSet();
    parseResourceAttributes(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(parseValueSetComposeComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expansion")) {
      res.setExpansion(parseValueSetExpansionComponent(xpp));
    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseValueSetComposeComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exclude")) {
      res.getExclude().add(parseValueSetConceptSetComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseString(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseValueSetConceptSetComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("filter")) {
      res.getFilter().add(parseValueSetConceptSetFilterComponent(xpp));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseValueSetConceptReferenceComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetConceptReferenceComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseValueSetConceptReferenceDesignationComponentContent(int eventType, XmlPullParser xpp, 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) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseValueSetConceptSetFilterComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetConceptSetFilterComponentContent(int eventType, XmlPullParser xpp, 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, Enumerations.FilterOperator.NULL, new Enumerations.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 parseValueSetExpansionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseValueSetExpansionComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetExpansionComponentContent(int eventType, XmlPullParser xpp, 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(parseValueSetExpansionParameterComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseValueSetExpansionPropertyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contains")) {
      res.getContains().add(parseValueSetExpansionContainsComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseValueSetExpansionParameterComponentContent(int eventType, XmlPullParser xpp, 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.ValueSetExpansionPropertyComponent parseValueSetExpansionPropertyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    ValueSet.ValueSetExpansionPropertyComponent res = new ValueSet.ValueSetExpansionPropertyComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseValueSetExpansionPropertyComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseValueSetExpansionPropertyComponentContent(int eventType, XmlPullParser xpp, ValueSet.ValueSetExpansionPropertyComponent 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 (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseValueSetExpansionContainsComponentContent(int eventType, XmlPullParser xpp, 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));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
      res.getProperty().add(parseValueSetConceptPropertyComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contains")) {
      res.getContains().add(parseValueSetExpansionContainsComponent(xpp));
    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseValueSetConceptPropertyComponentContent(int eventType, XmlPullParser xpp, ValueSet.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 VerificationResult parseVerificationResult(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    VerificationResult res = new VerificationResult();
    parseResourceAttributes(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(parseVerificationResultPrimarySourceComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attestation")) {
      res.setAttestation(parseVerificationResultAttestationComponent(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validator")) {
      res.getValidator().add(parseVerificationResultValidatorComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseVerificationResultPrimarySourceComponentContent(int eventType, XmlPullParser xpp, 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 parseVerificationResultAttestationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseVerificationResultAttestationComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVerificationResultAttestationComponentContent(int eventType, XmlPullParser xpp, 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 parseVerificationResultValidatorComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseVerificationResultValidatorComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVerificationResultValidatorComponentContent(int eventType, XmlPullParser xpp, 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();
    parseResourceAttributes(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, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
    } 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(parseVisionPrescriptionLensSpecificationComponent(xpp));
    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
      return false;
    }
    return true;
  }

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

  protected boolean parseVisionPrescriptionLensSpecificationComponentContent(int eventType, XmlPullParser xpp, 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));
    } 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) throws XmlPullParserException, IOException, FHIRFormatError {
    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
    parseElementAttributes(xpp, res);
    next(xpp);
    int eventType = nextNoWhitespace(xpp);
    while (eventType != XmlPullParser.END_TAG) {
    if (!parseVisionPrescriptionPrismComponentContent(eventType, xpp, res))
        unknownContent(xpp);
      eventType = nextNoWhitespace(xpp);
    }
    next(xpp);
    parseElementClose(res);
    return res;
  }

  protected boolean parseVisionPrescriptionPrismComponentContent(int eventType, XmlPullParser xpp, 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 == null) {
      throw new IOException("xpp == null!");
    } else if (xpp.getName().equals("Account")) {
      return parseAccount(xpp);
    } else if (xpp.getName().equals("ActivityDefinition")) {
      return parseActivityDefinition(xpp);
    } else if (xpp.getName().equals("AdministrableProductDefinition")) {
      return parseAdministrableProductDefinition(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("CapabilityStatement2")) {
      return parseCapabilityStatement2(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("Citation")) {
      return parseCitation(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("ClinicalUseIssue")) {
      return parseClinicalUseIssue(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("ConditionDefinition")) {
      return parseConditionDefinition(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("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("EvidenceFocus")) {
      return parseEvidenceFocus(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("Ingredient")) {
      return parseIngredient(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("ManufacturedItemDefinition")) {
      return parseManufacturedItemDefinition(xpp);
    } else if (xpp.getName().equals("Measure")) {
      return parseMeasure(xpp);
    } else if (xpp.getName().equals("MeasureReport")) {
      return parseMeasureReport(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("MedicationUsage")) {
      return parseMedicationUsage(xpp);
    } else if (xpp.getName().equals("MedicinalProductDefinition")) {
      return parseMedicinalProductDefinition(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("NutritionIntake")) {
      return parseNutritionIntake(xpp);
    } else if (xpp.getName().equals("NutritionOrder")) {
      return parseNutritionOrder(xpp);
    } else if (xpp.getName().equals("NutritionProduct")) {
      return parseNutritionProduct(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("PackagedProductDefinition")) {
      return parsePackagedProductDefinition(xpp);
    } else if (xpp.getName().equals("Parameters")) {
      return parseParameters(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("Permission")) {
      return parsePermission(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("RegulatedAuthorization")) {
      return parseRegulatedAuthorization(xpp);
    } else if (xpp.getName().equals("RelatedPerson")) {
      return parseRelatedPerson(xpp);
    } else if (xpp.getName().equals("RequestGroup")) {
      return parseRequestGroup(xpp);
    } else if (xpp.getName().equals("ResearchStudy")) {
      return parseResearchStudy(xpp);
    } else if (xpp.getName().equals("ResearchSubject")) {
      return parseResearchSubject(xpp);
    } else if (xpp.getName().equals("RiskAssessment")) {
      return parseRiskAssessment(xpp);
    } else if (xpp.getName().equals("Schedule")) {
      return parseSchedule(xpp);
    } else if (xpp.getName().equals("SearchParameter")) {
      return parseSearchParameter(xpp);
    } else if (xpp.getName().equals("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("SubscriptionStatus")) {
      return parseSubscriptionStatus(xpp);
    } else if (xpp.getName().equals("SubscriptionTopic")) {
      return parseSubscriptionTopic(xpp);
    } else if (xpp.getName().equals("Substance")) {
      return parseSubstance(xpp);
    } else if (xpp.getName().equals("SubstanceDefinition")) {
      return parseSubstanceDefinition(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("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 {
      throw new FHIRFormatError("Unknown resource type "+xpp.getName()+"");
    }
  }

  protected DataType parseType(String prefix, XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
    if (prefix == null) {
      throw new IOException("prefix == null!");
    } else if (xpp == null) {
      throw new IOException("xpp == null!");
    } 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+"Integer64")) {
      return parseInteger64(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+"Address")) {
      return parseAddress(xpp);
    } else if (xpp.getName().equals(prefix+"Age")) {
      return parseAge(xpp);
    } else if (xpp.getName().equals(prefix+"Annotation")) {
      return parseAnnotation(xpp);
    } else if (xpp.getName().equals(prefix+"Attachment")) {
      return parseAttachment(xpp);
    } else if (xpp.getName().equals(prefix+"CodeableConcept")) {
      return parseCodeableConcept(xpp);
    } else if (xpp.getName().equals(prefix+"CodeableReference")) {
      return parseCodeableReference(xpp);
    } else if (xpp.getName().equals(prefix+"Coding")) {
      return parseCoding(xpp);
    } else if (xpp.getName().equals(prefix+"ContactDetail")) {
      return parseContactDetail(xpp);
    } else if (xpp.getName().equals(prefix+"ContactPoint")) {
      return parseContactPoint(xpp);
    } else if (xpp.getName().equals(prefix+"Contributor")) {
      return parseContributor(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+"Distance")) {
      return parseDistance(xpp);
    } else if (xpp.getName().equals(prefix+"Dosage")) {
      return parseDosage(xpp);
    } else if (xpp.getName().equals(prefix+"Duration")) {
      return parseDuration(xpp);
    } else if (xpp.getName().equals(prefix+"ElementDefinition")) {
      return parseElementDefinition(xpp);
    } else if (xpp.getName().equals(prefix+"Expression")) {
      return parseExpression(xpp);
    } else if (xpp.getName().equals(prefix+"Extension")) {
      return parseExtension(xpp);
    } else if (xpp.getName().equals(prefix+"HumanName")) {
      return parseHumanName(xpp);
    } else if (xpp.getName().equals(prefix+"Identifier")) {
      return parseIdentifier(xpp);
    } else if (xpp.getName().equals(prefix+"MarketingStatus")) {
      return parseMarketingStatus(xpp);
    } else if (xpp.getName().equals(prefix+"Meta")) {
      return parseMeta(xpp);
    } else if (xpp.getName().equals(prefix+"Money")) {
      return parseMoney(xpp);
    } else if (xpp.getName().equals(prefix+"Narrative")) {
      return parseNarrative(xpp);
    } else if (xpp.getName().equals(prefix+"OrderedDistribution")) {
      return parseOrderedDistribution(xpp);
    } else if (xpp.getName().equals(prefix+"ParameterDefinition")) {
      return parseParameterDefinition(xpp);
    } else if (xpp.getName().equals(prefix+"Period")) {
      return parsePeriod(xpp);
    } else if (xpp.getName().equals(prefix+"Population")) {
      return parsePopulation(xpp);
    } else if (xpp.getName().equals(prefix+"ProdCharacteristic")) {
      return parseProdCharacteristic(xpp);
    } else if (xpp.getName().equals(prefix+"ProductShelfLife")) {
      return parseProductShelfLife(xpp);
    } else if (xpp.getName().equals(prefix+"Quantity")) {
      return parseQuantity(xpp);
    } else if (xpp.getName().equals(prefix+"Range")) {
      return parseRange(xpp);
    } else if (xpp.getName().equals(prefix+"Ratio")) {
      return parseRatio(xpp);
    } else if (xpp.getName().equals(prefix+"Reference")) {
      return parseReference(xpp);
    } else if (xpp.getName().equals(prefix+"RelatedArtifact")) {
      return parseRelatedArtifact(xpp);
    } else if (xpp.getName().equals(prefix+"SampledData")) {
      return parseSampledData(xpp);
    } else if (xpp.getName().equals(prefix+"Signature")) {
      return parseSignature(xpp);
    } else if (xpp.getName().equals(prefix+"Statistic")) {
      return parseStatistic(xpp);
    } else if (xpp.getName().equals(prefix+"SubstanceAmount")) {
      return parseSubstanceAmount(xpp);
    } else if (xpp.getName().equals(prefix+"Timing")) {
      return parseTiming(xpp);
    } else if (xpp.getName().equals(prefix+"TriggerDefinition")) {
      return parseTriggerDefinition(xpp);
    } else if (xpp.getName().equals(prefix+"UsageContext")) {
      return parseUsageContext(xpp);

    } else {
      throw new FHIRFormatError("Unknown type "+xpp.getName());
    }
  }

  protected DataType parseType(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
    if (type == null) {
      throw new IOException("type == null!");
    } else if (xpp == null) {
      throw new IOException("xpp == null!");
    } 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("integer64")) {
      return parseInteger64(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("Address")) {
      return parseAddress(xpp);
    } else if (type.equals("Age")) {
      return parseAge(xpp);
    } else if (type.equals("Annotation")) {
      return parseAnnotation(xpp);
    } else if (type.equals("Attachment")) {
      return parseAttachment(xpp);
    } else if (type.equals("CodeableConcept")) {
      return parseCodeableConcept(xpp);
    } else if (type.equals("CodeableReference")) {
      return parseCodeableReference(xpp);
    } else if (type.equals("Coding")) {
      return parseCoding(xpp);
    } else if (type.equals("ContactDetail")) {
      return parseContactDetail(xpp);
    } else if (type.equals("ContactPoint")) {
      return parseContactPoint(xpp);
    } else if (type.equals("Contributor")) {
      return parseContributor(xpp);
    } else if (type.equals("Count")) {
      return parseCount(xpp);
    } else if (type.equals("DataRequirement")) {
      return parseDataRequirement(xpp);
    } else if (type.equals("Distance")) {
      return parseDistance(xpp);
    } else if (type.equals("Dosage")) {
      return parseDosage(xpp);
    } else if (type.equals("Duration")) {
      return parseDuration(xpp);
    } else if (type.equals("ElementDefinition")) {
      return parseElementDefinition(xpp);
    } else if (type.equals("Expression")) {
      return parseExpression(xpp);
    } else if (type.equals("Extension")) {
      return parseExtension(xpp);
    } else if (type.equals("HumanName")) {
      return parseHumanName(xpp);
    } else if (type.equals("Identifier")) {
      return parseIdentifier(xpp);
    } else if (type.equals("MarketingStatus")) {
      return parseMarketingStatus(xpp);
    } else if (type.equals("Meta")) {
      return parseMeta(xpp);
    } else if (type.equals("Money")) {
      return parseMoney(xpp);
    } else if (type.equals("Narrative")) {
      return parseNarrative(xpp);
    } else if (type.equals("OrderedDistribution")) {
      return parseOrderedDistribution(xpp);
    } else if (type.equals("ParameterDefinition")) {
      return parseParameterDefinition(xpp);
    } else if (type.equals("Period")) {
      return parsePeriod(xpp);
    } else if (type.equals("Population")) {
      return parsePopulation(xpp);
    } else if (type.equals("ProdCharacteristic")) {
      return parseProdCharacteristic(xpp);
    } else if (type.equals("ProductShelfLife")) {
      return parseProductShelfLife(xpp);
    } else if (type.equals("Quantity")) {
      return parseQuantity(xpp);
    } else if (type.equals("Range")) {
      return parseRange(xpp);
    } else if (type.equals("Ratio")) {
      return parseRatio(xpp);
    } else if (type.equals("Reference")) {
      return parseReference(xpp);
    } else if (type.equals("RelatedArtifact")) {
      return parseRelatedArtifact(xpp);
    } else if (type.equals("SampledData")) {
      return parseSampledData(xpp);
    } else if (type.equals("Signature")) {
      return parseSignature(xpp);
    } else if (type.equals("Statistic")) {
      return parseStatistic(xpp);
    } else if (type.equals("SubstanceAmount")) {
      return parseSubstanceAmount(xpp);
    } else if (type.equals("Timing")) {
      return parseTiming(xpp);
    } else if (type.equals("TriggerDefinition")) {
      return parseTriggerDefinition(xpp);
    } else if (type.equals("UsageContext")) {
      return parseUsageContext(xpp);

    } else {
      throw new FHIRFormatError("Unknown type "+type);
    }
  }

  public Base parseFragment(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
    if (type == null) {
      throw new IOException("type == null!");
    } else if (xpp == null) {
      throw new IOException("xpp == null!");
    } else if (type.equals("Address")) {
      return parseAddress(xpp);
    } else if (type.equals("Age")) {
      return parseAge(xpp);
    } else if (type.equals("Annotation")) {
      return parseAnnotation(xpp);
    } else if (type.equals("Attachment")) {
      return parseAttachment(xpp);
    } else if (type.equals("CodeableConcept")) {
      return parseCodeableConcept(xpp);
    } else if (type.equals("CodeableReference")) {
      return parseCodeableReference(xpp);
    } else if (type.equals("Coding")) {
      return parseCoding(xpp);
    } else if (type.equals("ContactDetail")) {
      return parseContactDetail(xpp);
    } else if (type.equals("ContactPoint")) {
      return parseContactPoint(xpp);
    } else if (type.equals("Contributor")) {
      return parseContributor(xpp);
    } else if (type.equals("Count")) {
      return parseCount(xpp);
    } else if (type.equals("DataRequirement")) {
      return parseDataRequirement(xpp);
    } else if (type.equals("Distance")) {
      return parseDistance(xpp);
    } else if (type.equals("Dosage")) {
      return parseDosage(xpp);
    } else if (type.equals("Duration")) {
      return parseDuration(xpp);
    } else if (type.equals("ElementDefinition")) {
      return parseElementDefinition(xpp);
    } else if (type.equals("Expression")) {
      return parseExpression(xpp);
    } else if (type.equals("Extension")) {
      return parseExtension(xpp);
    } else if (type.equals("HumanName")) {
      return parseHumanName(xpp);
    } else if (type.equals("Identifier")) {
      return parseIdentifier(xpp);
    } else if (type.equals("MarketingStatus")) {
      return parseMarketingStatus(xpp);
    } else if (type.equals("Meta")) {
      return parseMeta(xpp);
    } else if (type.equals("Money")) {
      return parseMoney(xpp);
    } else if (type.equals("Narrative")) {
      return parseNarrative(xpp);
    } else if (type.equals("OrderedDistribution")) {
      return parseOrderedDistribution(xpp);
    } else if (type.equals("ParameterDefinition")) {
      return parseParameterDefinition(xpp);
    } else if (type.equals("Period")) {
      return parsePeriod(xpp);
    } else if (type.equals("Population")) {
      return parsePopulation(xpp);
    } else if (type.equals("ProdCharacteristic")) {
      return parseProdCharacteristic(xpp);
    } else if (type.equals("ProductShelfLife")) {
      return parseProductShelfLife(xpp);
    } else if (type.equals("Quantity")) {
      return parseQuantity(xpp);
    } else if (type.equals("Range")) {
      return parseRange(xpp);
    } else if (type.equals("Ratio")) {
      return parseRatio(xpp);
    } else if (type.equals("Reference")) {
      return parseReference(xpp);
    } else if (type.equals("RelatedArtifact")) {
      return parseRelatedArtifact(xpp);
    } else if (type.equals("SampledData")) {
      return parseSampledData(xpp);
    } else if (type.equals("Signature")) {
      return parseSignature(xpp);
    } else if (type.equals("Statistic")) {
      return parseStatistic(xpp);
    } else if (type.equals("SubstanceAmount")) {
      return parseSubstanceAmount(xpp);
    } else if (type.equals("Timing")) {
      return parseTiming(xpp);
    } else if (type.equals("TriggerDefinition")) {
      return parseTriggerDefinition(xpp);
    } else if (type.equals("UsageContext")) {
      return parseUsageContext(xpp);
    } else if (type.equals("Account")) {
      return parseAccount(xpp);
    } else if (type.equals("ActivityDefinition")) {
      return parseActivityDefinition(xpp);
    } else if (type.equals("AdministrableProductDefinition")) {
      return parseAdministrableProductDefinition(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("CapabilityStatement2")) {
      return parseCapabilityStatement2(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("Citation")) {
      return parseCitation(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("ClinicalUseIssue")) {
      return parseClinicalUseIssue(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("ConditionDefinition")) {
      return parseConditionDefinition(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("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("EvidenceFocus")) {
      return parseEvidenceFocus(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("Ingredient")) {
      return parseIngredient(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("ManufacturedItemDefinition")) {
      return parseManufacturedItemDefinition(xpp);
    } else if (type.equals("Measure")) {
      return parseMeasure(xpp);
    } else if (type.equals("MeasureReport")) {
      return parseMeasureReport(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("MedicationUsage")) {
      return parseMedicationUsage(xpp);
    } else if (type.equals("MedicinalProductDefinition")) {
      return parseMedicinalProductDefinition(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("NutritionIntake")) {
      return parseNutritionIntake(xpp);
    } else if (type.equals("NutritionOrder")) {
      return parseNutritionOrder(xpp);
    } else if (type.equals("NutritionProduct")) {
      return parseNutritionProduct(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("PackagedProductDefinition")) {
      return parsePackagedProductDefinition(xpp);
    } else if (type.equals("Parameters")) {
      return parseParameters(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("Permission")) {
      return parsePermission(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("RegulatedAuthorization")) {
      return parseRegulatedAuthorization(xpp);
    } else if (type.equals("RelatedPerson")) {
      return parseRelatedPerson(xpp);
    } else if (type.equals("RequestGroup")) {
      return parseRequestGroup(xpp);
    } else if (type.equals("ResearchStudy")) {
      return parseResearchStudy(xpp);
    } else if (type.equals("ResearchSubject")) {
      return parseResearchSubject(xpp);
    } else if (type.equals("RiskAssessment")) {
      return parseRiskAssessment(xpp);
    } else if (type.equals("Schedule")) {
      return parseSchedule(xpp);
    } else if (type.equals("SearchParameter")) {
      return parseSearchParameter(xpp);
    } else if (type.equals("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("SubscriptionStatus")) {
      return parseSubscriptionStatus(xpp);
    } else if (type.equals("SubscriptionTopic")) {
      return parseSubscriptionTopic(xpp);
    } else if (type.equals("Substance")) {
      return parseSubstance(xpp);
    } else if (type.equals("SubstanceDefinition")) {
      return parseSubstanceDefinition(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("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("integer64")) {
      return parseInteger64(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 {
      throw new FHIRFormatError("Unknown type "+type);
    }
  }

  private boolean nameIsTypeName(XmlPullParser xpp, String prefix) throws IOException {  
    if (prefix == null) {
      throw new IOException("prefix == null!");
    } else if (xpp == null) {
      throw new IOException("xpp == null!");
    } else if (xpp.getName().equals(prefix+"Address")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Age")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Annotation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Attachment")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CodeableConcept")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CodeableReference")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Coding")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ContactDetail")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ContactPoint")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Contributor")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Count")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DataRequirement")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Distance")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Dosage")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Duration")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ElementDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Expression")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Extension")) {
      return true;
    } else if (xpp.getName().equals(prefix+"HumanName")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Identifier")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MarketingStatus")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Meta")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Money")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Narrative")) {
      return true;
    } else if (xpp.getName().equals(prefix+"OrderedDistribution")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ParameterDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Period")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Population")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ProdCharacteristic")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ProductShelfLife")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Quantity")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Range")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Ratio")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Reference")) {
      return true;
    } else if (xpp.getName().equals(prefix+"RelatedArtifact")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SampledData")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Signature")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Statistic")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubstanceAmount")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Timing")) {
      return true;
    } else if (xpp.getName().equals(prefix+"TriggerDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"UsageContext")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Account")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ActivityDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"AdministrableProductDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"AdverseEvent")) {
      return true;
    } else if (xpp.getName().equals(prefix+"AllergyIntolerance")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Appointment")) {
      return true;
    } else if (xpp.getName().equals(prefix+"AppointmentResponse")) {
      return true;
    } else if (xpp.getName().equals(prefix+"AuditEvent")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Basic")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Binary")) {
      return true;
    } else if (xpp.getName().equals(prefix+"BiologicallyDerivedProduct")) {
      return true;
    } else if (xpp.getName().equals(prefix+"BodyStructure")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Bundle")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CapabilityStatement")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CapabilityStatement2")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CarePlan")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CareTeam")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CatalogEntry")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ChargeItem")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ChargeItemDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Citation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Claim")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ClaimResponse")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ClinicalImpression")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ClinicalUseIssue")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CodeSystem")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Communication")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CommunicationRequest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CompartmentDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Composition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ConceptMap")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Condition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ConditionDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Consent")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Contract")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Coverage")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CoverageEligibilityRequest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"CoverageEligibilityResponse")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DetectedIssue")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Device")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DeviceDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DeviceMetric")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DeviceRequest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DeviceUseStatement")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DiagnosticReport")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DocumentManifest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DocumentReference")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Encounter")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Endpoint")) {
      return true;
    } else if (xpp.getName().equals(prefix+"EnrollmentRequest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"EnrollmentResponse")) {
      return true;
    } else if (xpp.getName().equals(prefix+"EpisodeOfCare")) {
      return true;
    } else if (xpp.getName().equals(prefix+"EventDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Evidence")) {
      return true;
    } else if (xpp.getName().equals(prefix+"EvidenceFocus")) {
      return true;
    } else if (xpp.getName().equals(prefix+"EvidenceVariable")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ExampleScenario")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ExplanationOfBenefit")) {
      return true;
    } else if (xpp.getName().equals(prefix+"FamilyMemberHistory")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Flag")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Goal")) {
      return true;
    } else if (xpp.getName().equals(prefix+"GraphDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Group")) {
      return true;
    } else if (xpp.getName().equals(prefix+"GuidanceResponse")) {
      return true;
    } else if (xpp.getName().equals(prefix+"HealthcareService")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ImagingStudy")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Immunization")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ImmunizationEvaluation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ImmunizationRecommendation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ImplementationGuide")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Ingredient")) {
      return true;
    } else if (xpp.getName().equals(prefix+"InsurancePlan")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Invoice")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Library")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Linkage")) {
      return true;
    } else if (xpp.getName().equals(prefix+"List")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Location")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ManufacturedItemDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Measure")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MeasureReport")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Medication")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MedicationAdministration")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MedicationDispense")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MedicationKnowledge")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MedicationRequest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MedicationUsage")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MedicinalProductDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MessageDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MessageHeader")) {
      return true;
    } else if (xpp.getName().equals(prefix+"MolecularSequence")) {
      return true;
    } else if (xpp.getName().equals(prefix+"NamingSystem")) {
      return true;
    } else if (xpp.getName().equals(prefix+"NutritionIntake")) {
      return true;
    } else if (xpp.getName().equals(prefix+"NutritionOrder")) {
      return true;
    } else if (xpp.getName().equals(prefix+"NutritionProduct")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Observation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ObservationDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"OperationDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"OperationOutcome")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Organization")) {
      return true;
    } else if (xpp.getName().equals(prefix+"OrganizationAffiliation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"PackagedProductDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Parameters")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Patient")) {
      return true;
    } else if (xpp.getName().equals(prefix+"PaymentNotice")) {
      return true;
    } else if (xpp.getName().equals(prefix+"PaymentReconciliation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Permission")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Person")) {
      return true;
    } else if (xpp.getName().equals(prefix+"PlanDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Practitioner")) {
      return true;
    } else if (xpp.getName().equals(prefix+"PractitionerRole")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Procedure")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Provenance")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Questionnaire")) {
      return true;
    } else if (xpp.getName().equals(prefix+"QuestionnaireResponse")) {
      return true;
    } else if (xpp.getName().equals(prefix+"RegulatedAuthorization")) {
      return true;
    } else if (xpp.getName().equals(prefix+"RelatedPerson")) {
      return true;
    } else if (xpp.getName().equals(prefix+"RequestGroup")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ResearchStudy")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ResearchSubject")) {
      return true;
    } else if (xpp.getName().equals(prefix+"RiskAssessment")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Schedule")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SearchParameter")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ServiceRequest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Slot")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Specimen")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SpecimenDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"StructureDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"StructureMap")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Subscription")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubscriptionStatus")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubscriptionTopic")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Substance")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubstanceDefinition")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubstanceNucleicAcid")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubstancePolymer")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubstanceProtein")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubstanceReferenceInformation")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SubstanceSourceMaterial")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SupplyDelivery")) {
      return true;
    } else if (xpp.getName().equals(prefix+"SupplyRequest")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Task")) {
      return true;
    } else if (xpp.getName().equals(prefix+"TerminologyCapabilities")) {
      return true;
    } else if (xpp.getName().equals(prefix+"TestReport")) {
      return true;
    } else if (xpp.getName().equals(prefix+"TestScript")) {
      return true;
    } else if (xpp.getName().equals(prefix+"ValueSet")) {
      return true;
    } else if (xpp.getName().equals(prefix+"VerificationResult")) {
      return true;
    } else if (xpp.getName().equals(prefix+"VisionPrescription")) {
      return true;

    } else if (xpp.getName().equals(prefix+"Date")) {
      return true;
    } else if (xpp.getName().equals(prefix+"DateTime")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Code")) {
      return true;
    } else if (xpp.getName().equals(prefix+"String")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Integer")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Integer64")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Oid")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Canonical")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Uri")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Uuid")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Url")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Instant")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Boolean")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Base64Binary")) {
      return true;
    } else if (xpp.getName().equals(prefix+"UnsignedInt")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Markdown")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Time")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Id")) {
      return true;
    } else if (xpp.getName().equals(prefix+"PositiveInt")) {
      return true;
    } else if (xpp.getName().equals(prefix+"Decimal")) {
      return true;
    } else {
      return false;
    }
  }

  @Override
  protected DataType parseAnyType(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
    return parseType(xpp, type);
  }


//----------------- Composer -------------------------------------------------------------------------------------------

  protected <E extends Enum<E>> void composeEnumeration(String name, Enumeration<E> 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 composeInteger64(String name, Integer64Type 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 composeBackboneElementElements(BackboneElement element) throws IOException {
    composeElementElements(element);
    if (element.hasModifierExtension()) { 
      for (Extension e : element.getModifierExtension()) 
          composeExtension("modifierExtension", e);
    }
  }

  protected void composeBackboneTypeElements(BackboneType element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasModifierExtension()) { 
      for (Extension e : element.getModifierExtension()) 
          composeExtension("modifierExtension", e);
    }
  }

  protected void composeDataTypeElements(DataType element) throws IOException {
    composeElementElements(element);
  }

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

  protected void composeAddress(String name, Address element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAddressElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAddressElements(Address element) throws IOException {
    composeDataTypeElements(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 composeAge(String name, Age element) throws IOException {
    if (element != null) {
    composeElementAttributes(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 composeAnnotation(String name, Annotation element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAnnotationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAnnotationElements(Annotation element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasAuthor()) {
      composeType("author", element.getAuthor());
    }    if (element.hasTimeElement()) {
      composeDateTime("time", element.getTimeElement());
    }
    if (element.hasTextElement()) {
      composeMarkdown("text", element.getTextElement());
    }
  }

  protected void composeAttachment(String name, Attachment element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAttachmentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAttachmentElements(Attachment element) throws IOException {
    composeDataTypeElements(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()) {
      composeInteger64("size", element.getSizeElement());
    }
    if (element.hasHashElement()) {
      composeBase64Binary("hash", element.getHashElement());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasCreationElement()) {
      composeDateTime("creation", element.getCreationElement());
    }
    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.hasPagesElement()) {
      composePositiveInt("pages", element.getPagesElement());
    }
  }

  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeableConceptElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeableConceptElements(CodeableConcept element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasCoding()) { 
      for (Coding e : element.getCoding()) 
          composeCoding("coding", e);
    }
    if (element.hasTextElement()) {
      composeString("text", element.getTextElement());
    }
  }

  protected void composeCodeableReference(String name, CodeableReference element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeableReferenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeableReferenceElements(CodeableReference element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasConcept()) {
      composeCodeableConcept("concept", element.getConcept());
    }
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
  }

  protected void composeCoding(String name, Coding element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodingElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodingElements(Coding element) throws IOException {
    composeDataTypeElements(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 composeContactDetail(String name, ContactDetail element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContactDetailElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContactDetailElements(ContactDetail element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTelecom()) { 
      for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
    }
  }

  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContactPointElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContactPointElements(ContactPoint element) throws IOException {
    composeDataTypeElements(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 composeContributor(String name, Contributor element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContributorElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContributorElements(Contributor element) throws IOException {
    composeDataTypeElements(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 composeCount(String name, Count element) throws IOException {
    if (element != null) {
    composeElementAttributes(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 composeDataRequirement(String name, DataRequirement element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataRequirementElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataRequirementElements(DataRequirement element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory());
    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()) 
          composeDataRequirementCodeFilterComponent("codeFilter", e);
    }
    if (element.hasDateFilter()) { 
      for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
          composeDataRequirementDateFilterComponent("dateFilter", e);
    }
    if (element.hasLimitElement()) {
      composePositiveInt("limit", element.getLimitElement());
    }
    if (element.hasSort()) { 
      for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
          composeDataRequirementSortComponent("sort", e);
    }
  }

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

  protected void composeDataRequirementCodeFilterComponentElements(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 composeDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataRequirementDateFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataRequirementDateFilterComponentElements(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 composeDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDataRequirementSortComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDataRequirementSortComponentElements(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 composeDistance(String name, Distance element) throws IOException {
    if (element != null) {
    composeElementAttributes(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 composeDosage(String name, Dosage element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDosageElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDosageElements(Dosage element) throws IOException {
    composeBackboneTypeElements(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()) 
          composeDosageDoseAndRateComponent("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 composeDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDosageDoseAndRateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDosageDoseAndRateComponentElements(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 composeDuration(String name, Duration element) throws IOException {
    if (element != null) {
    composeElementAttributes(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 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 {
    composeBackboneTypeElements(element);
    if (element.hasPathElement()) {
      composeString("path", element.getPathElement());
    }
      if (element.hasRepresentation()) 
        for (Enumeration<ElementDefinition.PropertyRepresentation> 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()) {
      composeElementDefinitionSlicingComponent("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()) {
      composeElementDefinitionBaseComponent("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()) 
          composeElementDefinitionExampleComponent("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()) 
          composeElementDefinitionConstraintComponent("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()) {
      composeElementDefinitionBindingComponent("binding", element.getBinding());
    }
    if (element.hasMapping()) { 
      for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
          composeElementDefinitionMappingComponent("mapping", e);
    }
  }

  protected void composeElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionSlicingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionSlicingComponentElements(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasDiscriminator()) { 
      for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
          composeElementDefinitionSlicingDiscriminatorComponent("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 composeElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionSlicingDiscriminatorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionSlicingDiscriminatorComponentElements(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 composeElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionBaseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionBaseComponentElements(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<ElementDefinition.AggregationMode> e : element.getAggregation()) 
          composeEnumeration("aggregation", e, new ElementDefinition.AggregationModeEnumFactory());
    if (element.hasVersioningElement())
      composeEnumeration("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory());
  }

  protected void composeElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionExampleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionExampleComponentElements(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasLabelElement()) {
      composeString("label", element.getLabelElement());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionConstraintComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionConstraintComponentElements(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 composeElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionBindingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeElementDefinitionBindingComponentElements(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 composeElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeElementDefinitionMappingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

  protected void composeExpressionElements(Expression element) throws IOException {
    composeDataTypeElements(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 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 {
    composeDataTypeElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeHumanName(String name, HumanName element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHumanNameElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHumanNameElements(HumanName element) throws IOException {
    composeDataTypeElements(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 composeIdentifier(String name, Identifier element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeIdentifierElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeIdentifierElements(Identifier element) throws IOException {
    composeDataTypeElements(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 composeMarketingStatus(String name, MarketingStatus element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMarketingStatusElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMarketingStatusElements(MarketingStatus element) throws IOException {
    composeBackboneTypeElements(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 composeMeta(String name, Meta element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMetaElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMetaElements(Meta element) throws IOException {
    composeDataTypeElements(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 composeMoney(String name, Money element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMoneyElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMoneyElements(Money element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasValueElement()) {
      composeDecimal("value", element.getValueElement());
    }
    if (element.hasCurrencyElement()) {
      composeCode("currency", element.getCurrencyElement());
    }
  }

  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 {
    composeDataTypeElements(element);
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory());
    if (element.hasDiv()) {
      composeXhtml("div", element.getDiv());
    }
  }

  protected void composeOrderedDistribution(String name, OrderedDistribution element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOrderedDistributionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOrderedDistributionElements(OrderedDistribution element) throws IOException {
    composeBackboneTypeElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasNumberOfIntervalsElement()) {
      composeInteger("numberOfIntervals", element.getNumberOfIntervalsElement());
    }
    if (element.hasBottomOfFirstInterval()) {
      composeQuantity("bottomOfFirstInterval", element.getBottomOfFirstInterval());
    }
    if (element.hasInterval()) { 
      for (OrderedDistribution.OrderedDistributionIntervalComponent e : element.getInterval()) 
          composeOrderedDistributionIntervalComponent("interval", e);
    }
    if (element.hasTopOfInterval()) {
      composeQuantity("topOfInterval", element.getTopOfInterval());
    }
  }

  protected void composeOrderedDistributionIntervalComponent(String name, OrderedDistribution.OrderedDistributionIntervalComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOrderedDistributionIntervalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOrderedDistributionIntervalComponentElements(OrderedDistribution.OrderedDistributionIntervalComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasRankOrderElement()) {
      composeInteger("rankOrder", element.getRankOrderElement());
    }
    if (element.hasIntervalStatistic()) { 
      for (Statistic e : element.getIntervalStatistic()) 
          composeStatistic("intervalStatistic", e);
    }
  }

  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeParameterDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeParameterDefinitionElements(ParameterDefinition element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasNameElement()) {
      composeCode("name", element.getNameElement());
    }
    if (element.hasUseElement())
      composeEnumeration("use", element.getUseElement(), new Enumerations.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())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory());
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
  }

  protected void composePeriod(String name, Period element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePeriodElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePeriodElements(Period element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasStartElement()) {
      composeDateTime("start", element.getStartElement());
    }
    if (element.hasEndElement()) {
      composeDateTime("end", element.getEndElement());
    }
  }

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

  protected void composePopulationElements(Population element) throws IOException {
    composeBackboneTypeElements(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 composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProdCharacteristicElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

  protected void composeProductShelfLifeElements(ProductShelfLife element) throws IOException {
    composeBackboneTypeElements(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 composeQuantity(String name, Quantity element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuantityElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuantityElements(Quantity element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasValueElement()) {
      composeDecimal("value", element.getValueElement());
    }
    if (element.hasComparatorElement())
      composeEnumeration("comparator", element.getComparatorElement(), new Enumerations.QuantityComparatorEnumFactory());
    if (element.hasUnitElement()) {
      composeString("unit", element.getUnitElement());
    }
    if (element.hasSystemElement()) {
      composeUri("system", element.getSystemElement());
    }
    if (element.hasCodeElement()) {
      composeCode("code", element.getCodeElement());
    }
  }

  protected void composeRange(String name, Range element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRangeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRangeElements(Range element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasLow()) {
      composeQuantity("low", element.getLow());
    }
    if (element.hasHigh()) {
      composeQuantity("high", element.getHigh());
    }
  }

  protected void composeRatio(String name, Ratio element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRatioElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRatioElements(Ratio element) throws IOException {
    composeDataTypeElements(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) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeReferenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeReferenceElements(Reference element) throws IOException {
    composeDataTypeElements(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 composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRelatedArtifactElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRelatedArtifactElements(RelatedArtifact element) throws IOException {
    composeDataTypeElements(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 composeSampledData(String name, SampledData element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSampledDataElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSampledDataElements(SampledData element) throws IOException {
    composeDataTypeElements(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 composeSignature(String name, Signature element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSignatureElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSignatureElements(Signature element) throws IOException {
    composeDataTypeElements(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 composeStatistic(String name, Statistic element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStatisticElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStatisticElements(Statistic element) throws IOException {
    composeBackboneTypeElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasStatisticType()) {
      composeCodeableConcept("statisticType", element.getStatisticType());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasSampleSize()) {
      composeStatisticSampleSizeComponent("sampleSize", element.getSampleSize());
    }
    if (element.hasAttributeEstimate()) { 
      for (Statistic.StatisticAttributeEstimateComponent e : element.getAttributeEstimate()) 
          composeStatisticAttributeEstimateComponent("attributeEstimate", e);
    }
  }

  protected void composeStatisticSampleSizeComponent(String name, Statistic.StatisticSampleSizeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStatisticSampleSizeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStatisticSampleSizeComponentElements(Statistic.StatisticSampleSizeComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasNumberOfStudiesElement()) {
      composeInteger("numberOfStudies", element.getNumberOfStudiesElement());
    }
    if (element.hasNumberOfParticipantsElement()) {
      composeInteger("numberOfParticipants", element.getNumberOfParticipantsElement());
    }
    if (element.hasKnownDataCountElement()) {
      composeInteger("knownDataCount", element.getKnownDataCountElement());
    }
    if (element.hasNumeratorCountElement()) {
      composeInteger("numeratorCount", element.getNumeratorCountElement());
    }
  }

  protected void composeStatisticAttributeEstimateComponent(String name, Statistic.StatisticAttributeEstimateComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStatisticAttributeEstimateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStatisticAttributeEstimateComponentElements(Statistic.StatisticAttributeEstimateComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasLevelElement()) {
      composeDecimal("level", element.getLevelElement());
    }
    if (element.hasRange()) {
      composeRange("range", element.getRange());
    }
    if (element.hasEstimateQualifier()) { 
      for (Statistic.StatisticAttributeEstimateEstimateQualifierComponent e : element.getEstimateQualifier()) 
          composeStatisticAttributeEstimateEstimateQualifierComponent("estimateQualifier", e);
    }
  }

  protected void composeStatisticAttributeEstimateEstimateQualifierComponent(String name, Statistic.StatisticAttributeEstimateEstimateQualifierComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStatisticAttributeEstimateEstimateQualifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStatisticAttributeEstimateEstimateQualifierComponentElements(Statistic.StatisticAttributeEstimateEstimateQualifierComponent element) throws IOException {
    composeElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasLevelElement()) {
      composeDecimal("level", element.getLevelElement());
    }
    if (element.hasRange()) {
      composeRange("range", element.getRange());
    }
  }

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

  protected void composeSubstanceAmountElements(SubstanceAmount element) throws IOException {
    composeBackboneTypeElements(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()) {
      composeSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
    }
  }

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

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

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

  protected void composeTimingElements(Timing element) throws IOException {
    composeBackboneTypeElements(element);
    if (element.hasEvent()) { 
      for (DateTimeType e : element.getEvent()) 
          composeDateTime("event", e);
    }
    if (element.hasRepeat()) {
      composeTimingRepeatComponent("repeat", element.getRepeat());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
  }

  protected void composeTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTimingRepeatComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTimingRepeatComponentElements(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<Enumerations.DaysOfWeek> e : element.getDayOfWeek()) 
          composeEnumeration("dayOfWeek", e, new Enumerations.DaysOfWeekEnumFactory());
    if (element.hasTimeOfDay()) { 
      for (TimeType e : element.getTimeOfDay()) 
          composeTime("timeOfDay", e);
    }
      if (element.hasWhen()) 
        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
          composeEnumeration("when", e, new Timing.EventTimingEnumFactory());
    if (element.hasOffsetElement()) {
      composeUnsignedInt("offset", element.getOffsetElement());
    }
  }

  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTriggerDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTriggerDefinitionElements(TriggerDefinition element) throws IOException {
    composeDataTypeElements(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 composeUsageContext(String name, UsageContext element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeUsageContextElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeUsageContextElements(UsageContext element) throws IOException {
    composeDataTypeElements(element);
    if (element.hasCode()) {
      composeCoding("code", element.getCode());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeCanonicalResourceElements(CanonicalResource element) throws IOException {
    composeDomainResourceElements(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 composeMetadataResourceElements(MetadataResource element) throws IOException {
    composeCanonicalResourceElements(element);
  }

  protected void composeResourceElements(Resource element) throws IOException {
    composeBaseElements(element);
    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) {
    composeResourceAttributes(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeActivityDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeActivityDefinitionElements(ActivityDefinition element) throws IOException {
    composeMetadataResourceElements(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.RequestResourceTypeEnumFactory());
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory());
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new Enumerations.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()) 
          composeActivityDefinitionParticipantComponent("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()) 
          composeActivityDefinitionDynamicValueComponent("dynamicValue", e);
    }
  }

  protected void composeActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeActivityDefinitionParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeActivityDefinitionParticipantComponentElements(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory());
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
  }

  protected void composeActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeActivityDefinitionDynamicValueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeActivityDefinitionDynamicValueComponentElements(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPathElement()) {
      composeString("path", element.getPathElement());
    }
    if (element.hasExpression()) {
      composeExpression("expression", element.getExpression());
    }
  }

  protected void composeAdministrableProductDefinition(String name, AdministrableProductDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdministrableProductDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdministrableProductDefinitionElements(AdministrableProductDefinition 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.hasAdministrableDoseForm()) {
      composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
    }
    if (element.hasUnitOfPresentation()) {
      composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
    }
    if (element.hasProducedFrom()) { 
      for (Reference e : element.getProducedFrom()) 
          composeReference("producedFrom", e);
    }
    if (element.hasIngredient()) { 
      for (Reference e : element.getIngredient()) 
          composeReference("ingredient", e);
    }
    if (element.hasDevice()) { 
      for (Reference e : element.getDevice()) 
          composeReference("device", e);
    }
    if (element.hasProperty()) { 
      for (AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent e : element.getProperty()) 
          composeAdministrableProductDefinitionPropertyComponent("property", e);
    }
    if (element.hasRouteOfAdministration()) { 
      for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
          composeAdministrableProductDefinitionRouteOfAdministrationComponent("routeOfAdministration", e);
    }
  }

  protected void composeAdministrableProductDefinitionPropertyComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdministrableProductDefinitionPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdministrableProductDefinitionPropertyComponentElements(AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
  }

  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdministrableProductDefinitionRouteOfAdministrationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdministrableProductDefinitionRouteOfAdministrationComponentElements(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent 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 (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent("targetSpecies", e);
    }
  }

  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentElements(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasWithdrawalPeriod()) { 
      for (AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
          composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent("withdrawalPeriod", e);
    }
  }

  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentElements(AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent 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 composeAdverseEvent(String name, AdverseEvent element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new AdverseEvent.AdverseEventStatusEnumFactory());
    if (element.hasActualityElement())
      composeEnumeration("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory());
    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.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }    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.hasOutcome()) {
      composeCodeableConcept("outcome", element.getOutcome());
    }
    if (element.hasRecorder()) {
      composeReference("recorder", element.getRecorder());
    }
    if (element.hasParticipant()) { 
      for (AdverseEvent.AdverseEventParticipantComponent e : element.getParticipant()) 
          composeAdverseEventParticipantComponent("participant", e);
    }
    if (element.hasSuspectEntity()) { 
      for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
          composeAdverseEventSuspectEntityComponent("suspectEntity", e);
    }
    if (element.hasContributingFactor()) { 
      for (AdverseEvent.AdverseEventContributingFactorComponent e : element.getContributingFactor()) 
          composeAdverseEventContributingFactorComponent("contributingFactor", e);
    }
    if (element.hasPreventiveAction()) { 
      for (AdverseEvent.AdverseEventPreventiveActionComponent e : element.getPreventiveAction()) 
          composeAdverseEventPreventiveActionComponent("preventiveAction", e);
    }
    if (element.hasMitigatingAction()) { 
      for (AdverseEvent.AdverseEventMitigatingActionComponent e : element.getMitigatingAction()) 
          composeAdverseEventMitigatingActionComponent("mitigatingAction", e);
    }
    if (element.hasSupportingInfo()) { 
      for (AdverseEvent.AdverseEventSupportingInfoComponent e : element.getSupportingInfo()) 
          composeAdverseEventSupportingInfoComponent("supportingInfo", e);
    }
    if (element.hasStudy()) { 
      for (Reference e : element.getStudy()) 
          composeReference("study", e);
    }
  }

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

  protected void composeAdverseEventParticipantComponentElements(AdverseEvent.AdverseEventParticipantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

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

  protected void composeAdverseEventSuspectEntityComponentElements(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasInstance()) {
      composeType("instance", element.getInstance());
    }    if (element.hasCausality()) {
      composeAdverseEventSuspectEntityCausalityComponent("causality", element.getCausality());
    }
  }

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

  protected void composeAdverseEventSuspectEntityCausalityComponentElements(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAssessmentMethod()) {
      composeCodeableConcept("assessmentMethod", element.getAssessmentMethod());
    }
    if (element.hasEntityRelatedness()) {
      composeCodeableConcept("entityRelatedness", element.getEntityRelatedness());
    }
    if (element.hasAuthor()) {
      composeReference("author", element.getAuthor());
    }
  }

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

  protected void composeAdverseEventContributingFactorComponentElements(AdverseEvent.AdverseEventContributingFactorComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }  }

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

  protected void composeAdverseEventPreventiveActionComponentElements(AdverseEvent.AdverseEventPreventiveActionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }  }

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

  protected void composeAdverseEventMitigatingActionComponentElements(AdverseEvent.AdverseEventMitigatingActionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }  }

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

  protected void composeAdverseEventSupportingInfoComponentElements(AdverseEvent.AdverseEventSupportingInfoComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }  }

  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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<AllergyIntolerance.AllergyIntoleranceCategory> 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()) 
          composeAllergyIntoleranceReactionComponent("reaction", e);
    }
  }

  protected void composeAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAllergyIntoleranceReactionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAllergyIntoleranceReactionComponentElements(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) {
    composeResourceAttributes(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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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()) 
          composeAppointmentParticipantComponent("participant", e);
    }
    if (element.hasRequestedPeriod()) { 
      for (Period e : element.getRequestedPeriod()) 
          composePeriod("requestedPeriod", e);
    }
  }

  protected void composeAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAppointmentParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAppointmentParticipantComponentElements(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 Enumerations.ParticipationStatusEnumFactory());
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
  }

  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.ParticipationStatusEnumFactory());
    if (element.hasCommentElement()) {
      composeString("comment", element.getCommentElement());
    }
  }

  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.hasSeverityElement())
      composeEnumeration("severity", element.getSeverityElement(), new AuditEvent.AuditEventSeverityEnumFactory());
    if (element.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasRecordedElement()) {
      composeInstant("recorded", element.getRecordedElement());
    }
    if (element.hasOutcome()) {
      composeCodeableConcept("outcome", element.getOutcome());
    }
    if (element.hasPurposeOfEvent()) { 
      for (CodeableConcept e : element.getPurposeOfEvent()) 
          composeCodeableConcept("purposeOfEvent", e);
    }
    if (element.hasAgent()) { 
      for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
          composeAuditEventAgentComponent("agent", e);
    }
    if (element.hasSource()) {
      composeAuditEventSourceComponent("source", element.getSource());
    }
    if (element.hasEntity()) { 
      for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
          composeAuditEventEntityComponent("entity", e);
    }
  }

  protected void composeAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventAgentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventAgentComponentElements(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()) {
      composeAuditEventAgentNetworkComponent("network", element.getNetwork());
    }
    if (element.hasPurposeOfUse()) { 
      for (CodeableConcept e : element.getPurposeOfUse()) 
          composeCodeableConcept("purposeOfUse", e);
    }
  }

  protected void composeAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventAgentNetworkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventAgentNetworkComponentElements(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 composeAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventSourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventSourceComponentElements(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 composeAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventEntityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventEntityComponentElements(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.hasQueryElement()) {
      composeBase64Binary("query", element.getQueryElement());
    }
    if (element.hasDetail()) { 
      for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
          composeAuditEventEntityDetailComponent("detail", e);
    }
  }

  protected void composeAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeAuditEventEntityDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeAuditEventEntityDetailComponentElements(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) {
    composeResourceAttributes(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) {
    composeResourceAttributes(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()) {
      composeBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
    }
    if (element.hasProcessing()) { 
      for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
          composeBiologicallyDerivedProductProcessingComponent("processing", e);
    }
    if (element.hasManipulation()) {
      composeBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
    }
    if (element.hasStorage()) { 
      for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
          composeBiologicallyDerivedProductStorageComponent("storage", e);
    }
  }

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

  protected void composeBiologicallyDerivedProductCollectionComponentElements(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 composeBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBiologicallyDerivedProductProcessingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBiologicallyDerivedProductProcessingComponentElements(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 composeBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBiologicallyDerivedProductManipulationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

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

  protected void composeBiologicallyDerivedProductStorageComponentElements(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) {
    composeResourceAttributes(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()) 
          composeBundleLinkComponent("link", e);
    }
    if (element.hasEntry()) { 
      for (Bundle.BundleEntryComponent e : element.getEntry()) 
          composeBundleEntryComponent("entry", e);
    }
    if (element.hasSignature()) {
      composeSignature("signature", element.getSignature());
    }
  }

  protected void composeBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleLinkComponentElements(Bundle.BundleLinkComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRelationElement()) {
      composeString("relation", element.getRelationElement());
    }
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
  }

  protected void composeBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleEntryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleEntryComponentElements(Bundle.BundleEntryComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasLink()) { 
      for (Bundle.BundleLinkComponent e : element.getLink()) 
          composeBundleLinkComponent("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()) {
      composeBundleEntrySearchComponent("search", element.getSearch());
    }
    if (element.hasRequest()) {
      composeBundleEntryRequestComponent("request", element.getRequest());
    }
    if (element.hasResponse()) {
      composeBundleEntryResponseComponent("response", element.getResponse());
    }
  }

  protected void composeBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleEntrySearchComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleEntrySearchComponentElements(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 composeBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleEntryRequestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleEntryRequestComponentElements(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 composeBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeBundleEntryResponseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeBundleEntryResponseComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementElements(CapabilityStatement element) throws IOException {
    composeCanonicalResourceElements(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 Enumerations.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()) {
      composeCapabilityStatementSoftwareComponent("software", element.getSoftware());
    }
    if (element.hasImplementation()) {
      composeCapabilityStatementImplementationComponent("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()) 
          composeCapabilityStatementRestComponent("rest", e);
    }
    if (element.hasMessaging()) { 
      for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
          composeCapabilityStatementMessagingComponent("messaging", e);
    }
    if (element.hasDocument()) { 
      for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
          composeCapabilityStatementDocumentComponent("document", e);
    }
  }

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

  protected void composeCapabilityStatementSoftwareComponentElements(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 composeCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementImplementationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementImplementationComponentElements(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 composeCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementRestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementRestComponentElements(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasModeElement())
      composeEnumeration("mode", element.getModeElement(), new Enumerations.RestfulCapabilityModeEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
    if (element.hasSecurity()) {
      composeCapabilityStatementRestSecurityComponent("security", element.getSecurity());
    }
    if (element.hasResource()) { 
      for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
          composeCapabilityStatementRestResourceComponent("resource", e);
    }
    if (element.hasInteraction()) { 
      for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
          composeCapabilityStatementSystemInteractionComponent("interaction", e);
    }
    if (element.hasSearchParam()) { 
      for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
          composeCapabilityStatementRestResourceSearchParamComponent("searchParam", e);
    }
    if (element.hasOperation()) { 
      for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
          composeCapabilityStatementRestResourceOperationComponent("operation", e);
    }
    if (element.hasCompartment()) { 
      for (CanonicalType e : element.getCompartment()) 
          composeCanonical("compartment", e);
    }
  }

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

  protected void composeCapabilityStatementRestSecurityComponentElements(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 composeCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementRestResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementRestResourceComponentElements(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<CapabilityStatement.ReferenceHandlingPolicy> 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()) 
          composeCapabilityStatementRestResourceSearchParamComponent("searchParam", e);
    }
    if (element.hasOperation()) { 
      for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
          composeCapabilityStatementRestResourceOperationComponent("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 composeCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementRestResourceSearchParamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementRestResourceSearchParamComponentElements(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 composeCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementRestResourceOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementRestResourceOperationComponentElements(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 composeCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementMessagingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementMessagingComponentElements(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasEndpoint()) { 
      for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
          composeCapabilityStatementMessagingEndpointComponent("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()) 
          composeCapabilityStatementMessagingSupportedMessageComponent("supportedMessage", e);
    }
  }

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

  protected void composeCapabilityStatementMessagingEndpointComponentElements(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProtocol()) {
      composeCoding("protocol", element.getProtocol());
    }
    if (element.hasAddressElement()) {
      composeUrl("address", element.getAddressElement());
    }
  }

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

  protected void composeCapabilityStatementMessagingSupportedMessageComponentElements(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 composeCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatementDocumentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatementDocumentComponentElements(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 composeCapabilityStatement2(String name, CapabilityStatement2 element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2Elements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2Elements(CapabilityStatement2 element) throws IOException {
    composeCanonicalResourceElements(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 Enumerations.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()) {
      composeCapabilityStatement2SoftwareComponent("software", element.getSoftware());
    }
    if (element.hasImplementation()) {
      composeCapabilityStatement2ImplementationComponent("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 (CapabilityStatement2.CapabilityStatement2RestComponent e : element.getRest()) 
          composeCapabilityStatement2RestComponent("rest", e);
    }
  }

  protected void composeCapabilityStatement2SoftwareComponent(String name, CapabilityStatement2.CapabilityStatement2SoftwareComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2SoftwareComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2SoftwareComponentElements(CapabilityStatement2.CapabilityStatement2SoftwareComponent 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 composeCapabilityStatement2ImplementationComponent(String name, CapabilityStatement2.CapabilityStatement2ImplementationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2ImplementationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2ImplementationComponentElements(CapabilityStatement2.CapabilityStatement2ImplementationComponent 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 composeCapabilityStatement2RestComponent(String name, CapabilityStatement2.CapabilityStatement2RestComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2RestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2RestComponentElements(CapabilityStatement2.CapabilityStatement2RestComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasModeElement())
      composeEnumeration("mode", element.getModeElement(), new Enumerations.RestfulCapabilityModeEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
    if (element.hasResource()) { 
      for (CapabilityStatement2.CapabilityStatement2RestResourceComponent e : element.getResource()) 
          composeCapabilityStatement2RestResourceComponent("resource", e);
    }
    if (element.hasInteraction()) { 
      for (CapabilityStatement2.SystemInteractionComponent e : element.getInteraction()) 
          composeCapabilityStatement2SystemInteractionComponent("interaction", e);
    }
    if (element.hasSearchParam()) { 
      for (CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent e : element.getSearchParam()) 
          composeCapabilityStatement2RestResourceSearchParamComponent("searchParam", e);
    }
    if (element.hasOperation()) { 
      for (CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent e : element.getOperation()) 
          composeCapabilityStatement2RestResourceOperationComponent("operation", e);
    }
    if (element.hasCompartment()) { 
      for (CanonicalType e : element.getCompartment()) 
          composeCanonical("compartment", e);
    }
  }

  protected void composeCapabilityStatement2RestResourceComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2RestResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2RestResourceComponentElements(CapabilityStatement2.CapabilityStatement2RestResourceComponent 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 (CapabilityStatement2.ResourceInteractionComponent e : element.getInteraction()) 
          composeCapabilityStatement2ResourceInteractionComponent("interaction", e);
    }
    if (element.hasSearchParam()) { 
      for (CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent e : element.getSearchParam()) 
          composeCapabilityStatement2RestResourceSearchParamComponent("searchParam", e);
    }
    if (element.hasOperation()) { 
      for (CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent e : element.getOperation()) 
          composeCapabilityStatement2RestResourceOperationComponent("operation", e);
    }
  }

  protected void composeCapabilityStatement2ResourceInteractionComponent(String name, CapabilityStatement2.ResourceInteractionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2ResourceInteractionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2ResourceInteractionComponentElements(CapabilityStatement2.ResourceInteractionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement())
      composeEnumeration("code", element.getCodeElement(), new CapabilityStatement2.TypeRestfulInteractionEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
  }

  protected void composeCapabilityStatement2RestResourceSearchParamComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2RestResourceSearchParamComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2RestResourceSearchParamComponentElements(CapabilityStatement2.CapabilityStatement2RestResourceSearchParamComponent 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 composeCapabilityStatement2RestResourceOperationComponent(String name, CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2RestResourceOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2RestResourceOperationComponentElements(CapabilityStatement2.CapabilityStatement2RestResourceOperationComponent 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 composeCapabilityStatement2SystemInteractionComponent(String name, CapabilityStatement2.SystemInteractionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCapabilityStatement2SystemInteractionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCapabilityStatement2SystemInteractionComponentElements(CapabilityStatement2.SystemInteractionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement())
      composeEnumeration("code", element.getCodeElement(), new CapabilityStatement2.SystemRestfulInteractionEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
  }

  protected void composeCarePlan(String name, CarePlan element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.RequestStatusEnumFactory());
    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 (CodeableReference e : element.getAddresses()) 
          composeCodeableReference("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()) 
          composeCarePlanActivityComponent("activity", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCarePlanActivityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCarePlanActivityComponentElements(CarePlan.CarePlanActivityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasOutcome()) { 
      for (CodeableReference e : element.getOutcome()) 
          composeCodeableReference("outcome", e);
    }
    if (element.hasProgress()) { 
      for (Annotation e : element.getProgress()) 
          composeAnnotation("progress", e);
    }
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
    if (element.hasDetail()) {
      composeCarePlanActivityDetailComponent("detail", element.getDetail());
    }
  }

  protected void composeCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCarePlanActivityDetailComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCarePlanActivityDetailComponentElements(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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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()) {
      composeCodeableReference("location", element.getLocation());
    }
    if (element.hasReported()) {
      composeType("reported", element.getReported());
    }    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) {
    composeResourceAttributes(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.hasPeriod()) {
      composePeriod("period", element.getPeriod());
    }
    if (element.hasParticipant()) { 
      for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
          composeCareTeamParticipantComponent("participant", e);
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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 composeCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCareTeamParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCareTeamParticipantComponentElements(CareTeam.CareTeamParticipantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasMember()) {
      composeReference("member", element.getMember());
    }
    if (element.hasOnBehalfOf()) {
      composeReference("onBehalfOf", element.getOnBehalfOf());
    }
    if (element.hasCoverage()) {
      composeType("coverage", element.getCoverage());
    }  }

  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new CatalogEntry.CatalogEntryTypeEnumFactory());
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new CatalogEntry.CatalogEntryStatusEnumFactory());
    if (element.hasEffectivePeriod()) {
      composePeriod("effectivePeriod", element.getEffectivePeriod());
    }
    if (element.hasOrderableElement()) {
      composeBoolean("orderable", element.getOrderableElement());
    }
    if (element.hasReferencedItem()) {
      composeReference("referencedItem", element.getReferencedItem());
    }
    if (element.hasRelatedEntry()) { 
      for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
          composeCatalogEntryRelatedEntryComponent("relatedEntry", e);
    }
    if (element.hasUpdatedBy()) {
      composeReference("updatedBy", element.getUpdatedBy());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasEstimatedDuration()) {
      composeDuration("estimatedDuration", element.getEstimatedDuration());
    }
    if (element.hasBillingCode()) { 
      for (CodeableConcept e : element.getBillingCode()) 
          composeCodeableConcept("billingCode", e);
    }
    if (element.hasBillingSummaryElement()) {
      composeString("billingSummary", element.getBillingSummaryElement());
    }
    if (element.hasScheduleSummaryElement()) {
      composeString("scheduleSummary", element.getScheduleSummaryElement());
    }
    if (element.hasLimitationSummaryElement()) {
      composeString("limitationSummary", element.getLimitationSummaryElement());
    }
    if (element.hasRegulatorySummaryElement()) {
      composeString("regulatorySummary", element.getRegulatorySummaryElement());
    }
  }

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

  protected void composeCatalogEntryRelatedEntryComponentElements(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRelationshipElement())
      composeEnumeration("relationship", element.getRelationshipElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory());
    if (element.hasTarget()) {
      composeReference("target", element.getTarget());
    }
  }

  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeChargeItemPerformerComponent("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 composeChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemPerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemPerformerComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeChargeItemDefinitionElements(ChargeItemDefinition element) throws IOException {
    composeMetadataResourceElements(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()) 
          composeChargeItemDefinitionApplicabilityComponent("applicability", e);
    }
    if (element.hasPropertyGroup()) { 
      for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
          composeChargeItemDefinitionPropertyGroupComponent("propertyGroup", e);
    }
  }

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

  protected void composeChargeItemDefinitionApplicabilityComponentElements(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 composeChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeChargeItemDefinitionPropertyGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

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

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

  protected void composeCitation(String name, Citation element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationElements(Citation element) throws IOException {
    composeMetadataResourceElements(element);
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasUseContext()) { 
      for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
    }
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasRelatedIdentifier()) { 
      for (Identifier e : element.getRelatedIdentifier()) 
          composeIdentifier("relatedIdentifier", e);
    }
    if (element.hasDateCitedElement()) {
      composeDateTime("dateCited", element.getDateCitedElement());
    }
    if (element.hasVariantCitation()) {
      composeCitationVariantCitationComponent("variantCitation", element.getVariantCitation());
    }
    if (element.hasPublishingModel()) {
      composeCodeableConcept("publishingModel", element.getPublishingModel());
    }
    if (element.hasJournal()) {
      composeCitationJournalComponent("journal", element.getJournal());
    }
    if (element.hasArticleTitleElement()) {
      composeMarkdown("articleTitle", element.getArticleTitleElement());
    }
    if (element.hasAlternativeTitle()) { 
      for (Citation.CitationAlternativeTitleComponent e : element.getAlternativeTitle()) 
          composeCitationAlternativeTitleComponent("alternativeTitle", e);
    }
    if (element.hasPagination()) {
      composeCitationPaginationComponent("pagination", element.getPagination());
    }
    if (element.hasArticleUrl()) { 
      for (Citation.CitationArticleUrlComponent e : element.getArticleUrl()) 
          composeCitationArticleUrlComponent("articleUrl", e);
    }
    if (element.hasAbstractElement()) {
      composeMarkdown("abstract", element.getAbstractElement());
    }
    if (element.hasAbstractCopyrightElement()) {
      composeMarkdown("abstractCopyright", element.getAbstractCopyrightElement());
    }
    if (element.hasAlternativeAbstract()) { 
      for (Citation.CitationAlternativeAbstractComponent e : element.getAlternativeAbstract()) 
          composeCitationAlternativeAbstractComponent("alternativeAbstract", e);
    }
    if (element.hasAuthorList()) {
      composeCitationAuthorListComponent("authorList", element.getAuthorList());
    }
    if (element.hasAuthorString()) { 
      for (Citation.CitationAuthorStringComponent e : element.getAuthorString()) 
          composeCitationAuthorStringComponent("authorString", e);
    }
    if (element.hasContributorList()) {
      composeCitationContributorListComponent("contributorList", element.getContributorList());
    }
    if (element.hasArticleLanguage()) {
      composeCodeableConcept("articleLanguage", element.getArticleLanguage());
    }
    if (element.hasAlternativeForm()) { 
      for (Citation.CitationAlternativeFormComponent e : element.getAlternativeForm()) 
          composeCitationAlternativeFormComponent("alternativeForm", e);
    }
    if (element.hasClassifier()) { 
      for (CodeableConcept e : element.getClassifier()) 
          composeCodeableConcept("classifier", e);
    }
    if (element.hasRelatedArtifact()) { 
      for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasMedlinePubMed()) {
      composeCitationMedlinePubMedComponent("medlinePubMed", element.getMedlinePubMed());
    }
  }

  protected void composeCitationVariantCitationComponent(String name, Citation.CitationVariantCitationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationVariantCitationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationVariantCitationComponentElements(Citation.CitationVariantCitationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
    if (element.hasBaseCitation()) {
      composeReference("baseCitation", element.getBaseCitation());
    }
  }

  protected void composeCitationJournalComponent(String name, Citation.CitationJournalComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationJournalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationJournalComponentElements(Citation.CitationJournalComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasCountryElement()) {
      composeString("country", element.getCountryElement());
    }
    if (element.hasJournalIssue()) {
      composeCitationJournalJournalIssueComponent("journalIssue", element.getJournalIssue());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
  }

  protected void composeCitationJournalJournalIssueComponent(String name, Citation.CitationJournalJournalIssueComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationJournalJournalIssueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationJournalJournalIssueComponentElements(Citation.CitationJournalJournalIssueComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCitedMedium()) {
      composeCodeableConcept("citedMedium", element.getCitedMedium());
    }
    if (element.hasVolumeElement()) {
      composeString("volume", element.getVolumeElement());
    }
    if (element.hasIssueElement()) {
      composeString("issue", element.getIssueElement());
    }
    if (element.hasPublicationDateElement()) {
      composeString("publicationDate", element.getPublicationDateElement());
    }
  }

  protected void composeCitationAlternativeTitleComponent(String name, Citation.CitationAlternativeTitleComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAlternativeTitleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAlternativeTitleComponentElements(Citation.CitationAlternativeTitleComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasLanguage()) {
      composeCodeableConcept("language", element.getLanguage());
    }
    if (element.hasTitleElement()) {
      composeMarkdown("title", element.getTitleElement());
    }
  }

  protected void composeCitationPaginationComponent(String name, Citation.CitationPaginationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationPaginationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationPaginationComponentElements(Citation.CitationPaginationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPageStringElement()) {
      composeString("pageString", element.getPageStringElement());
    }
    if (element.hasFirstPageElement()) {
      composeString("firstPage", element.getFirstPageElement());
    }
    if (element.hasLastPageElement()) {
      composeString("lastPage", element.getLastPageElement());
    }
  }

  protected void composeCitationArticleUrlComponent(String name, Citation.CitationArticleUrlComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationArticleUrlComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationArticleUrlComponentElements(Citation.CitationArticleUrlComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
  }

  protected void composeCitationAlternativeAbstractComponent(String name, Citation.CitationAlternativeAbstractComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAlternativeAbstractComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAlternativeAbstractComponentElements(Citation.CitationAlternativeAbstractComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasLanguage()) {
      composeCodeableConcept("language", element.getLanguage());
    }
    if (element.hasAbstractElement()) {
      composeMarkdown("abstract", element.getAbstractElement());
    }
    if (element.hasAbstractCopyrightElement()) {
      composeMarkdown("abstractCopyright", element.getAbstractCopyrightElement());
    }
  }

  protected void composeCitationAuthorListComponent(String name, Citation.CitationAuthorListComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAuthorListComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAuthorListComponentElements(Citation.CitationAuthorListComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCompleteElement()) {
      composeBoolean("complete", element.getCompleteElement());
    }
    if (element.hasAuthor()) { 
      for (Citation.CitationAuthorListAuthorComponent e : element.getAuthor()) 
          composeCitationAuthorListAuthorComponent("author", e);
    }
  }

  protected void composeCitationAuthorListAuthorComponent(String name, Citation.CitationAuthorListAuthorComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAuthorListAuthorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAuthorListAuthorComponentElements(Citation.CitationAuthorListAuthorComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasLastNameElement()) {
      composeString("lastName", element.getLastNameElement());
    }
    if (element.hasForeNameElement()) {
      composeString("foreName", element.getForeNameElement());
    }
    if (element.hasSuffixElement()) {
      composeString("suffix", element.getSuffixElement());
    }
    if (element.hasInitialsElement()) {
      composeString("initials", element.getInitialsElement());
    }
    if (element.hasCollectiveNameElement()) {
      composeString("collectiveName", element.getCollectiveNameElement());
    }
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasAffiliationInfo()) { 
      for (Citation.CitationAuthorListAuthorAffiliationInfoComponent e : element.getAffiliationInfo()) 
          composeCitationAuthorListAuthorAffiliationInfoComponent("affiliationInfo", e);
    }
    if (element.hasAddress()) { 
      for (StringType e : element.getAddress()) 
          composeString("address", e);
    }
    if (element.hasTelecom()) { 
      for (ContactPoint e : element.getTelecom()) 
          composeContactPoint("telecom", e);
    }
    if (element.hasCorrespondingAuthorElement()) {
      composeBoolean("correspondingAuthor", element.getCorrespondingAuthorElement());
    }
    if (element.hasListOrderElement()) {
      composePositiveInt("listOrder", element.getListOrderElement());
    }
  }

  protected void composeCitationAuthorListAuthorAffiliationInfoComponent(String name, Citation.CitationAuthorListAuthorAffiliationInfoComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAuthorListAuthorAffiliationInfoComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAuthorListAuthorAffiliationInfoComponentElements(Citation.CitationAuthorListAuthorAffiliationInfoComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAffiliationElement()) {
      composeString("affiliation", element.getAffiliationElement());
    }
    if (element.hasRoleElement()) {
      composeString("role", element.getRoleElement());
    }
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
  }

  protected void composeCitationAuthorStringComponent(String name, Citation.CitationAuthorStringComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAuthorStringComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAuthorStringComponentElements(Citation.CitationAuthorStringComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSource()) {
      composeCodeableConcept("source", element.getSource());
    }
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
  }

  protected void composeCitationContributorListComponent(String name, Citation.CitationContributorListComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationContributorListComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationContributorListComponentElements(Citation.CitationContributorListComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCompleteElement()) {
      composeBoolean("complete", element.getCompleteElement());
    }
    if (element.hasContributor()) { 
      for (Citation.CitationContributorListContributorComponent e : element.getContributor()) 
          composeCitationContributorListContributorComponent("contributor", e);
    }
  }

  protected void composeCitationContributorListContributorComponent(String name, Citation.CitationContributorListContributorComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationContributorListContributorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationContributorListContributorComponentElements(Citation.CitationContributorListContributorComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasLastNameElement()) {
      composeString("lastName", element.getLastNameElement());
    }
    if (element.hasForeNameElement()) {
      composeString("foreName", element.getForeNameElement());
    }
    if (element.hasSuffixElement()) {
      composeString("suffix", element.getSuffixElement());
    }
    if (element.hasInitialsElement()) {
      composeString("initials", element.getInitialsElement());
    }
    if (element.hasCollectiveNameElement()) {
      composeString("collectiveName", element.getCollectiveNameElement());
    }
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasContribution()) { 
      for (CodeableConcept e : element.getContribution()) 
          composeCodeableConcept("contribution", e);
    }
    if (element.hasAffiliationInfo()) { 
      for (Citation.CitationContributorListContributorAffiliationInfoComponent e : element.getAffiliationInfo()) 
          composeCitationContributorListContributorAffiliationInfoComponent("affiliationInfo", e);
    }
    if (element.hasListOrderElement()) {
      composePositiveInt("listOrder", element.getListOrderElement());
    }
  }

  protected void composeCitationContributorListContributorAffiliationInfoComponent(String name, Citation.CitationContributorListContributorAffiliationInfoComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationContributorListContributorAffiliationInfoComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationContributorListContributorAffiliationInfoComponentElements(Citation.CitationContributorListContributorAffiliationInfoComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAffiliationElement()) {
      composeString("affiliation", element.getAffiliationElement());
    }
    if (element.hasRoleElement()) {
      composeString("role", element.getRoleElement());
    }
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
  }

  protected void composeCitationAlternativeFormComponent(String name, Citation.CitationAlternativeFormComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAlternativeFormComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAlternativeFormComponentElements(Citation.CitationAlternativeFormComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPublishingModel()) {
      composeCodeableConcept("publishingModel", element.getPublishingModel());
    }
    if (element.hasLanguage()) {
      composeCodeableConcept("language", element.getLanguage());
    }
    if (element.hasJournalIssue()) {
      composeCitationAlternativeFormJournalIssueComponent("journalIssue", element.getJournalIssue());
    }
    if (element.hasPagination()) {
      composeCitationAlternativeFormPaginationComponent("pagination", element.getPagination());
    }
  }

  protected void composeCitationAlternativeFormJournalIssueComponent(String name, Citation.CitationAlternativeFormJournalIssueComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAlternativeFormJournalIssueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAlternativeFormJournalIssueComponentElements(Citation.CitationAlternativeFormJournalIssueComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCitedMedium()) {
      composeCodeableConcept("citedMedium", element.getCitedMedium());
    }
    if (element.hasVolumeElement()) {
      composeString("volume", element.getVolumeElement());
    }
    if (element.hasIssueElement()) {
      composeString("issue", element.getIssueElement());
    }
    if (element.hasPublicationDateElement()) {
      composeString("publicationDate", element.getPublicationDateElement());
    }
  }

  protected void composeCitationAlternativeFormPaginationComponent(String name, Citation.CitationAlternativeFormPaginationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationAlternativeFormPaginationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationAlternativeFormPaginationComponentElements(Citation.CitationAlternativeFormPaginationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPageStringElement()) {
      composeString("pageString", element.getPageStringElement());
    }
    if (element.hasFirstPageElement()) {
      composeString("firstPage", element.getFirstPageElement());
    }
    if (element.hasLastPageElement()) {
      composeString("lastPage", element.getLastPageElement());
    }
  }

  protected void composeCitationMedlinePubMedComponent(String name, Citation.CitationMedlinePubMedComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationMedlinePubMedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationMedlinePubMedComponentElements(Citation.CitationMedlinePubMedComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasMedlineState()) {
      composeCodeableConcept("medlineState", element.getMedlineState());
    }
    if (element.hasOwner()) {
      composeCodeableConcept("owner", element.getOwner());
    }
    if (element.hasPmidElement()) {
      composePositiveInt("pmid", element.getPmidElement());
    }
    if (element.hasPmidVersionElement()) {
      composePositiveInt("pmidVersion", element.getPmidVersionElement());
    }
    if (element.hasDateCreatedElement()) {
      composeDate("dateCreated", element.getDateCreatedElement());
    }
    if (element.hasDateCompletedElement()) {
      composeDate("dateCompleted", element.getDateCompletedElement());
    }
    if (element.hasDateRevisedElement()) {
      composeDate("dateRevised", element.getDateRevisedElement());
    }
    if (element.hasPubMedPubDate()) { 
      for (Citation.CitationMedlinePubMedPubMedPubDateComponent e : element.getPubMedPubDate()) 
          composeCitationMedlinePubMedPubMedPubDateComponent("pubMedPubDate", e);
    }
    if (element.hasPublicationState()) {
      composeCodeableConcept("publicationState", element.getPublicationState());
    }
    if (element.hasRelatedArticle()) { 
      for (Citation.CitationMedlinePubMedRelatedArticleComponent e : element.getRelatedArticle()) 
          composeCitationMedlinePubMedRelatedArticleComponent("relatedArticle", e);
    }
  }

  protected void composeCitationMedlinePubMedPubMedPubDateComponent(String name, Citation.CitationMedlinePubMedPubMedPubDateComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationMedlinePubMedPubMedPubDateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationMedlinePubMedPubMedPubDateComponentElements(Citation.CitationMedlinePubMedPubMedPubDateComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPublicationState()) {
      composeCodeableConcept("publicationState", element.getPublicationState());
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
  }

  protected void composeCitationMedlinePubMedRelatedArticleComponent(String name, Citation.CitationMedlinePubMedRelatedArticleComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCitationMedlinePubMedRelatedArticleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCitationMedlinePubMedRelatedArticleComponentElements(Citation.CitationMedlinePubMedRelatedArticleComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCitationReference()) {
      composeReference("citationReference", element.getCitationReference());
    }
    if (element.hasCitationMarkdownElement()) {
      composeMarkdown("citationMarkdown", element.getCitationMarkdownElement());
    }
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
  }

  protected void composeClaim(String name, Claim element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubType()) {
      composeCodeableConcept("subType", element.getSubType());
    }
    if (element.hasUseElement())
      composeEnumeration("use", element.getUseElement(), new Enumerations.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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSubType()) {
      composeCodeableConcept("subType", element.getSubType());
    }
    if (element.hasUseElement())
      composeEnumeration("use", element.getUseElement(), new Enumerations.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 Enumerations.ClaimProcessingCodesEnumFactory());
    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) {
    composeResourceAttributes(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 Enumerations.EventStatusEnumFactory());
    if (element.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    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.hasPerformer()) {
      composeReference("performer", element.getPerformer());
    }
    if (element.hasPrevious()) {
      composeReference("previous", element.getPrevious());
    }
    if (element.hasProblem()) { 
      for (Reference e : element.getProblem()) 
          composeReference("problem", 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()) 
          composeClinicalImpressionFindingComponent("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 composeClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalImpressionFindingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalImpressionFindingComponentElements(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeCodeableReference("item", element.getItem());
    }
    if (element.hasBasisElement()) {
      composeString("basis", element.getBasisElement());
    }
  }

  protected void composeClinicalUseIssue(String name, ClinicalUseIssue element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalUseIssueElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalUseIssueElements(ClinicalUseIssue element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new ClinicalUseIssue.ClinicalUseIssueTypeEnumFactory());
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasSubject()) { 
      for (Reference e : element.getSubject()) 
          composeReference("subject", e);
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasContraindication()) {
      composeClinicalUseIssueContraindicationComponent("contraindication", element.getContraindication());
    }
    if (element.hasIndication()) {
      composeClinicalUseIssueIndicationComponent("indication", element.getIndication());
    }
    if (element.hasInteraction()) {
      composeClinicalUseIssueInteractionComponent("interaction", element.getInteraction());
    }
    if (element.hasPopulation()) { 
      for (Population e : element.getPopulation()) 
          composePopulation("population", e);
    }
    if (element.hasUndesirableEffect()) {
      composeClinicalUseIssueUndesirableEffectComponent("undesirableEffect", element.getUndesirableEffect());
    }
  }

  protected void composeClinicalUseIssueContraindicationComponent(String name, ClinicalUseIssue.ClinicalUseIssueContraindicationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalUseIssueContraindicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalUseIssueContraindicationComponentElements(ClinicalUseIssue.ClinicalUseIssueContraindicationComponent element) throws IOException {
    composeBackboneElementElements(element);
    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.hasIndication()) { 
      for (Reference e : element.getIndication()) 
          composeReference("indication", e);
    }
    if (element.hasOtherTherapy()) { 
      for (ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
          composeClinicalUseIssueContraindicationOtherTherapyComponent("otherTherapy", e);
    }
  }

  protected void composeClinicalUseIssueContraindicationOtherTherapyComponent(String name, ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalUseIssueContraindicationOtherTherapyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalUseIssueContraindicationOtherTherapyComponentElements(ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTherapyRelationshipType()) {
      composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
    }
    if (element.hasMedication()) {
      composeType("medication", element.getMedication());
    }  }

  protected void composeClinicalUseIssueIndicationComponent(String name, ClinicalUseIssue.ClinicalUseIssueIndicationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalUseIssueIndicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalUseIssueIndicationComponentElements(ClinicalUseIssue.ClinicalUseIssueIndicationComponent element) throws IOException {
    composeBackboneElementElements(element);
    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.hasUndesirableEffect()) { 
      for (Reference e : element.getUndesirableEffect()) 
          composeReference("undesirableEffect", e);
    }
    if (element.hasOtherTherapy()) { 
      for (ClinicalUseIssue.ClinicalUseIssueContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
          composeClinicalUseIssueContraindicationOtherTherapyComponent("otherTherapy", e);
    }
  }

  protected void composeClinicalUseIssueInteractionComponent(String name, ClinicalUseIssue.ClinicalUseIssueInteractionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalUseIssueInteractionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalUseIssueInteractionComponentElements(ClinicalUseIssue.ClinicalUseIssueInteractionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasInteractant()) { 
      for (ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent e : element.getInteractant()) 
          composeClinicalUseIssueInteractionInteractantComponent("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 composeClinicalUseIssueInteractionInteractantComponent(String name, ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalUseIssueInteractionInteractantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalUseIssueInteractionInteractantComponentElements(ClinicalUseIssue.ClinicalUseIssueInteractionInteractantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeType("item", element.getItem());
    }  }

  protected void composeClinicalUseIssueUndesirableEffectComponent(String name, ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeClinicalUseIssueUndesirableEffectComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeClinicalUseIssueUndesirableEffectComponentElements(ClinicalUseIssue.ClinicalUseIssueUndesirableEffectComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSymptomConditionEffect()) {
      composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
    }
    if (element.hasClassification()) {
      composeCodeableConcept("classification", element.getClassification());
    }
    if (element.hasFrequencyOfOccurrence()) {
      composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
    }
  }

  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemElements(CodeSystem element) throws IOException {
    composeCanonicalResourceElements(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()) 
          composeCodeSystemFilterComponent("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 composeCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCodeSystemFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCodeSystemFilterComponentElements(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<Enumerations.FilterOperator> e : element.getOperator()) 
          composeEnumeration("operator", e, new Enumerations.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) {
    composeResourceAttributes(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 Enumerations.EventStatusEnumFactory());
    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 Enumerations.RequestPriorityEnumFactory());
    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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasPayload()) { 
      for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
          composeCommunicationPayloadComponent("payload", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCommunicationPayloadComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCommunicationPayloadComponentElements(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) {
    composeResourceAttributes(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 Enumerations.RequestStatusEnumFactory());
    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 Enumerations.RequestPriorityEnumFactory());
    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()) 
          composeCommunicationRequestPayloadComponent("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.hasInformationProvider()) { 
      for (Reference e : element.getInformationProvider()) 
          composeReference("informationProvider", e);
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCommunicationRequestPayloadComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCommunicationRequestPayloadComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompartmentDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompartmentDefinitionElements(CompartmentDefinition element) throws IOException {
    composeCanonicalResourceElements(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 Enumerations.CompartmentTypeEnumFactory());
    if (element.hasSearchElement()) {
      composeBoolean("search", element.getSearchElement());
    }
    if (element.hasResource()) { 
      for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
          composeCompartmentDefinitionResourceComponent("resource", e);
    }
  }

  protected void composeCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompartmentDefinitionResourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompartmentDefinitionResourceComponentElements(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) {
    composeResourceAttributes(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 Enumerations.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.V3ConfidentialityClassificationEnumFactory());
    if (element.hasAttester()) { 
      for (Composition.CompositionAttesterComponent e : element.getAttester()) 
          composeCompositionAttesterComponent("attester", e);
    }
    if (element.hasCustodian()) {
      composeReference("custodian", element.getCustodian());
    }
    if (element.hasRelatesTo()) { 
      for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
          composeCompositionRelatesToComponent("relatesTo", e);
    }
    if (element.hasEvent()) { 
      for (Composition.CompositionEventComponent e : element.getEvent()) 
          composeCompositionEventComponent("event", e);
    }
    if (element.hasSection()) { 
      for (Composition.SectionComponent e : element.getSection()) 
          composeCompositionSectionComponent("section", e);
    }
  }

  protected void composeCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionAttesterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionAttesterComponentElements(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 composeCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionRelatesToComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionRelatesToComponentElements(Composition.CompositionRelatesToComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement())
      composeEnumeration("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory());
    if (element.hasTarget()) {
      composeType("target", element.getTarget());
    }  }

  protected void composeCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeCompositionEventComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeCompositionEventComponentElements(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 Enumerations.ListModeEnumFactory());
    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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapElements(ConceptMap element) throws IOException {
    composeCanonicalResourceElements(element);
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifierFirstRep());
    }
    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()) 
          composeConceptMapGroupComponent("group", e);
    }
  }

  protected void composeConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapGroupComponentElements(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()) {
      composeConceptMapGroupUnmappedComponent("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.hasNoMapElement()) {
      composeBoolean("noMap", element.getNoMapElement());
    }
    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.hasRelationshipElement())
      composeEnumeration("relationship", element.getRelationshipElement(), new Enumerations.ConceptMapRelationshipEnumFactory());
    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 composeConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConceptMapGroupUnmappedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConceptMapGroupUnmappedComponentElements(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) {
    composeResourceAttributes(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()) 
          composeConditionStageComponent("stage", e);
    }
    if (element.hasEvidence()) { 
      for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
          composeConditionEvidenceComponent("evidence", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionStageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionStageComponentElements(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 composeConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionEvidenceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionEvidenceComponentElements(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 composeConditionDefinition(String name, ConditionDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionDefinitionElements(ConditionDefinition element) throws IOException {
    composeMetadataResourceElements(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.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.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasSeverity()) {
      composeCodeableConcept("severity", element.getSeverity());
    }
    if (element.hasBodySite()) {
      composeCodeableConcept("bodySite", element.getBodySite());
    }
    if (element.hasStage()) {
      composeCodeableConcept("stage", element.getStage());
    }
    if (element.hasHasSeverityElement()) {
      composeBoolean("hasSeverity", element.getHasSeverityElement());
    }
    if (element.hasHasBodySiteElement()) {
      composeBoolean("hasBodySite", element.getHasBodySiteElement());
    }
    if (element.hasHasStageElement()) {
      composeBoolean("hasStage", element.getHasStageElement());
    }
    if (element.hasDefinition()) { 
      for (UriType e : element.getDefinition()) 
          composeUri("definition", e);
    }
    if (element.hasObservation()) { 
      for (ConditionDefinition.ConditionDefinitionObservationComponent e : element.getObservation()) 
          composeConditionDefinitionObservationComponent("observation", e);
    }
    if (element.hasMedication()) { 
      for (ConditionDefinition.ConditionDefinitionMedicationComponent e : element.getMedication()) 
          composeConditionDefinitionMedicationComponent("medication", e);
    }
    if (element.hasPrecondition()) { 
      for (ConditionDefinition.ConditionDefinitionPreconditionComponent e : element.getPrecondition()) 
          composeConditionDefinitionPreconditionComponent("precondition", e);
    }
    if (element.hasTeam()) { 
      for (Reference e : element.getTeam()) 
          composeReference("team", e);
    }
    if (element.hasQuestionnaire()) { 
      for (ConditionDefinition.ConditionDefinitionQuestionnaireComponent e : element.getQuestionnaire()) 
          composeConditionDefinitionQuestionnaireComponent("questionnaire", e);
    }
    if (element.hasPlan()) { 
      for (ConditionDefinition.ConditionDefinitionPlanComponent e : element.getPlan()) 
          composeConditionDefinitionPlanComponent("plan", e);
    }
  }

  protected void composeConditionDefinitionObservationComponent(String name, ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionDefinitionObservationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionDefinitionObservationComponentElements(ConditionDefinition.ConditionDefinitionObservationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
  }

  protected void composeConditionDefinitionMedicationComponent(String name, ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionDefinitionMedicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionDefinitionMedicationComponentElements(ConditionDefinition.ConditionDefinitionMedicationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
  }

  protected void composeConditionDefinitionPreconditionComponent(String name, ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionDefinitionPreconditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionDefinitionPreconditionComponentElements(ConditionDefinition.ConditionDefinitionPreconditionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new ConditionDefinition.ConditionPreconditionTypeEnumFactory());
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeConditionDefinitionQuestionnaireComponent(String name, ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionDefinitionQuestionnaireComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionDefinitionQuestionnaireComponentElements(ConditionDefinition.ConditionDefinitionQuestionnaireComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPurposeElement())
      composeEnumeration("purpose", element.getPurposeElement(), new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory());
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
  }

  protected void composeConditionDefinitionPlanComponent(String name, ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeConditionDefinitionPlanComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeConditionDefinitionPlanComponentElements(ConditionDefinition.ConditionDefinitionPlanComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
  }

  protected void composeConsent(String name, Consent element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    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.hasSourceAttachment()) { 
      for (Attachment e : element.getSourceAttachment()) 
          composeAttachment("sourceAttachment", e);
    }
    if (element.hasSourceReference()) { 
      for (Reference e : element.getSourceReference()) 
          composeReference("sourceReference", e);
    }
    if (element.hasPolicy()) { 
      for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
          composeConsentPolicyComponent("policy", e);
    }
    if (element.hasPolicyRule()) {
      composeCodeableConcept("policyRule", element.getPolicyRule());
    }
    if (element.hasVerification()) { 
      for (Consent.ConsentVerificationComponent e : element.getVerification()) 
          composeConsentVerificationComponent("verification", e);
    }
    if (element.hasProvision()) {
      composeConsentProvisionComponent("provision", element.getProvision());
    }
  }

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

  protected void composeConsentPolicyComponentElements(Consent.ConsentPolicyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAuthorityElement()) {
      composeUri("authority", element.getAuthorityElement());
    }
    if (element.hasUriElement()) {
      composeUri("uri", element.getUriElement());
    }
  }

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

  protected void composeConsentVerificationComponentElements(Consent.ConsentVerificationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasVerifiedElement()) {
      composeBoolean("verified", element.getVerifiedElement());
    }
    if (element.hasVerificationType()) {
      composeCodeableConcept("verificationType", element.getVerificationType());
    }
    if (element.hasVerifiedBy()) {
      composeReference("verifiedBy", element.getVerifiedBy());
    }
    if (element.hasVerifiedWith()) {
      composeReference("verifiedWith", element.getVerifiedWith());
    }
    if (element.hasVerificationDate()) { 
      for (DateTimeType e : element.getVerificationDate()) 
          composeDateTime("verificationDate", e);
    }
  }

  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) {
    composeResourceAttributes(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.ContractResourceStatusCodesEnumFactory());
    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.ContractResourcePublicationStatusCodesEnumFactory());
    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()) {
      composeContractOfferComponent("offer", element.getOffer());
    }
    if (element.hasAsset()) { 
      for (Contract.ContractAssetComponent e : element.getAsset()) 
          composeContractAssetComponent("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 composeContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractOfferComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractOfferComponentElements(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()) 
          composeContractPartyComponent("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 composeContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractPartyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractPartyComponentElements(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 composeContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeContractAssetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeContractAssetComponentElements(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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasPolicyHolder()) {
      composeReference("policyHolder", element.getPolicyHolder());
    }
    if (element.hasSubscriber()) {
      composeReference("subscriber", element.getSubscriber());
    }
    if (element.hasSubscriberId()) {
      composeIdentifier("subscriberId", element.getSubscriberId());
    }
    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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    if (element.hasPriority()) {
      composeCodeableConcept("priority", element.getPriority());
    }
      if (element.hasPurpose()) 
        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> 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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
      if (element.hasPurpose()) 
        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> 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.ClaimProcessingCodesEnumFactory());
    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) {
    composeResourceAttributes(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 Enumerations.ObservationStatusEnumFactory());
    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()) 
          composeDetectedIssueEvidenceComponent("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()) 
          composeDetectedIssueMitigationComponent("mitigation", e);
    }
  }

  protected void composeDetectedIssueEvidenceComponent(String name, DetectedIssue.DetectedIssueEvidenceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDetectedIssueEvidenceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDetectedIssueEvidenceComponentElements(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 composeDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDetectedIssueMitigationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDetectedIssueMitigationComponentElements(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) {
    composeResourceAttributes(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.hasDisplayNameElement()) {
      composeString("displayName", element.getDisplayNameElement());
    }
    if (element.hasDefinition()) {
      composeReference("definition", element.getDefinition());
    }
    if (element.hasUdiCarrier()) { 
      for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
          composeDeviceUdiCarrierComponent("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()) 
          composeDeviceDeviceNameComponent("deviceName", e);
    }
    if (element.hasModelNumberElement()) {
      composeString("modelNumber", element.getModelNumberElement());
    }
    if (element.hasPartNumberElement()) {
      composeString("partNumber", element.getPartNumberElement());
    }
    if (element.hasType()) { 
      for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
    }
    if (element.hasSpecialization()) { 
      for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
          composeDeviceSpecializationComponent("specialization", e);
    }
    if (element.hasVersion()) { 
      for (Device.DeviceVersionComponent e : element.getVersion()) 
          composeDeviceVersionComponent("version", e);
    }
    if (element.hasProperty()) { 
      for (Device.DevicePropertyComponent e : element.getProperty()) 
          composeDevicePropertyComponent("property", e);
    }
    if (element.hasPatient()) {
      composeReference("patient", element.getPatient());
    }
    if (element.hasOperationalStatus()) {
      composeDeviceOperationalStatusComponent("operationalStatus", element.getOperationalStatus());
    }
    if (element.hasAssociationStatus()) {
      composeDeviceAssociationStatusComponent("associationStatus", element.getAssociationStatus());
    }
    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 composeDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceUdiCarrierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceUdiCarrierComponentElements(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 composeDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDeviceNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

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

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

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

  protected void composeDeviceVersionComponentElements(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 composeDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDevicePropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDevicePropertyComponentElements(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 composeDeviceOperationalStatusComponent(String name, Device.DeviceOperationalStatusComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceOperationalStatusComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceOperationalStatusComponentElements(Device.DeviceOperationalStatusComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeCodeableConcept("value", element.getValue());
    }
    if (element.hasReason()) { 
      for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
    }
  }

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

  protected void composeDeviceAssociationStatusComponentElements(Device.DeviceAssociationStatusComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeCodeableConcept("value", element.getValue());
    }
    if (element.hasReason()) { 
      for (CodeableConcept e : element.getReason()) 
          composeCodeableConcept("reason", e);
    }
  }

  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeDeviceDefinitionUdiDeviceIdentifierComponent("udiDeviceIdentifier", e);
    }
    if (element.hasManufacturer()) {
      composeType("manufacturer", element.getManufacturer());
    }    if (element.hasDeviceName()) { 
      for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
          composeDeviceDefinitionDeviceNameComponent("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()) 
          composeDeviceDefinitionSpecializationComponent("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()) 
          composeDeviceDefinitionCapabilityComponent("capability", e);
    }
    if (element.hasProperty()) { 
      for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
          composeDeviceDefinitionPropertyComponent("property", e);
    }
    if (element.hasOwner()) {
      composeReference("owner", element.getOwner());
    }
    if (element.hasContact()) { 
      for (ContactPoint e : element.getContact()) 
          composeContactPoint("contact", e);
    }
    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()) 
          composeDeviceDefinitionMaterialComponent("material", e);
    }
  }

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

  protected void composeDeviceDefinitionUdiDeviceIdentifierComponentElements(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 composeDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionDeviceNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

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

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

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

  protected void composeDeviceDefinitionCapabilityComponentElements(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 composeDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionPropertyComponentElements(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 composeDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceDefinitionMaterialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceDefinitionMaterialComponentElements(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) {
    composeResourceAttributes(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()) 
          composeDeviceMetricCalibrationComponent("calibration", e);
    }
  }

  protected void composeDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceMetricCalibrationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceMetricCalibrationComponentElements(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) {
    composeResourceAttributes(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 Enumerations.RequestStatusEnumFactory());
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory());
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory());
    if (element.hasCode()) {
      composeCodeableReference("code", element.getCode());
    }
    if (element.hasParameter()) { 
      for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
          composeDeviceRequestParameterComponent("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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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 composeDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDeviceRequestParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDeviceRequestParameterComponentElements(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) {
    composeResourceAttributes(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.hasCategory()) { 
      for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasDerivedFrom()) { 
      for (Reference e : element.getDerivedFrom()) 
          composeReference("derivedFrom", e);
    }
    if (element.hasContext()) {
      composeReference("context", element.getContext());
    }
    if (element.hasTiming()) {
      composeType("timing", element.getTiming());
    }    if (element.hasDateAssertedElement()) {
      composeDateTime("dateAsserted", element.getDateAssertedElement());
    }
    if (element.hasUsageStatus()) {
      composeCodeableConcept("usageStatus", element.getUsageStatus());
    }
    if (element.hasUsageReason()) { 
      for (CodeableConcept e : element.getUsageReason()) 
          composeCodeableConcept("usageReason", e);
    }
    if (element.hasInformationSource()) {
      composeReference("informationSource", element.getInformationSource());
    }
    if (element.hasDevice()) {
      composeCodeableReference("device", element.getDevice());
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasBodySite()) {
      composeCodeableReference("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) {
    composeResourceAttributes(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()) 
          composeDiagnosticReportMediaComponent("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 composeDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDiagnosticReportMediaComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDiagnosticReportMediaComponentElements(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) {
    composeResourceAttributes(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()) 
          composeDocumentManifestRelatedComponent("related", e);
    }
  }

  protected void composeDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentManifestRelatedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentManifestRelatedComponentElements(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) {
    composeResourceAttributes(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 Enumerations.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.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()) 
          composeDocumentReferenceRelatesToComponent("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()) 
          composeDocumentReferenceContentComponent("content", e);
    }
    if (element.hasContext()) {
      composeDocumentReferenceContextComponent("context", element.getContext());
    }
  }

  protected void composeDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceRelatesToComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceRelatesToComponentElements(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement())
      composeEnumeration("code", element.getCodeElement(), new Enumerations.DocumentRelationshipTypeEnumFactory());
    if (element.hasTarget()) {
      composeReference("target", element.getTarget());
    }
  }

  protected void composeDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceContentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceContentComponentElements(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAttachment()) {
      composeAttachment("attachment", element.getAttachment());
    }
    if (element.hasFormat()) {
      composeCoding("format", element.getFormat());
    }
  }

  protected void composeDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeDocumentReferenceContextComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeDocumentReferenceContextComponentElements(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);
    }
    if (element.hasBasedOn()) { 
      for (Reference e : element.getBasedOn()) 
          composeReference("basedOn", e);
    }
  }

  protected void composeEncounter(String name, Encounter element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.hasSubjectStatus()) {
      composeCodeableConcept("subjectStatus", element.getSubjectStatus());
    }
    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()) 
          composeEncounterParticipantComponent("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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasDiagnosis()) { 
      for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
          composeEncounterDiagnosisComponent("diagnosis", e);
    }
    if (element.hasAccount()) { 
      for (Reference e : element.getAccount()) 
          composeReference("account", e);
    }
    if (element.hasHospitalization()) {
      composeEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
    }
    if (element.hasLocation()) { 
      for (Encounter.EncounterLocationComponent e : element.getLocation()) 
          composeEncounterLocationComponent("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 composeEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterParticipantComponentElements(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 composeEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterHospitalizationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterHospitalizationComponentElements(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 composeEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEncounterLocationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEncounterLocationComponentElements(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) {
    composeResourceAttributes(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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    if (element.hasRequest()) {
      composeReference("request", element.getRequest());
    }
    if (element.hasOutcomeElement())
      composeEnumeration("outcome", element.getOutcomeElement(), new Enumerations.ClaimProcessingCodesEnumFactory());
    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) {
    composeResourceAttributes(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()) 
          composeEpisodeOfCareStatusHistoryComponent("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 composeEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEpisodeOfCareStatusHistoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEpisodeOfCareStatusHistoryComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEventDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEventDefinitionElements(EventDefinition element) throws IOException {
    composeMetadataResourceElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceElements(Evidence element) throws IOException {
    composeMetadataResourceElements(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.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasUseContext()) { 
      for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
    }
    if (element.hasApprovalDateElement()) {
      composeDate("approvalDate", element.getApprovalDateElement());
    }
    if (element.hasLastReviewDateElement()) {
      composeDate("lastReviewDate", element.getLastReviewDateElement());
    }
    if (element.hasContributor()) { 
      for (Contributor e : element.getContributor()) 
          composeContributor("contributor", e);
    }
    if (element.hasRelatedArtifact()) { 
      for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasAssertionElement()) {
      composeMarkdown("assertion", element.getAssertionElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasVariableDefinition()) { 
      for (Evidence.EvidenceVariableDefinitionComponent e : element.getVariableDefinition()) 
          composeEvidenceVariableDefinitionComponent("variableDefinition", e);
    }
    if (element.hasSynthesisType()) {
      composeCodeableConcept("synthesisType", element.getSynthesisType());
    }
    if (element.hasStudyType()) {
      composeCodeableConcept("studyType", element.getStudyType());
    }
    if (element.hasStatistic()) { 
      for (Statistic e : element.getStatistic()) 
          composeStatistic("statistic", e);
    }
    if (element.hasDistribution()) { 
      for (OrderedDistribution e : element.getDistribution()) 
          composeOrderedDistribution("distribution", e);
    }
    if (element.hasCertainty()) { 
      for (Evidence.EvidenceCertaintyComponent e : element.getCertainty()) 
          composeEvidenceCertaintyComponent("certainty", e);
    }
  }

  protected void composeEvidenceVariableDefinitionComponent(String name, Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceVariableDefinitionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceVariableDefinitionComponentElements(Evidence.EvidenceVariableDefinitionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasVariableRole()) {
      composeCodeableConcept("variableRole", element.getVariableRole());
    }
    if (element.hasObserved()) {
      composeReference("observed", element.getObserved());
    }
    if (element.hasIntended()) {
      composeReference("intended", element.getIntended());
    }
    if (element.hasDirectnessMatch()) {
      composeCodeableConcept("directnessMatch", element.getDirectnessMatch());
    }
  }

  protected void composeEvidenceCertaintyComponent(String name, Evidence.EvidenceCertaintyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceCertaintyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceCertaintyComponentElements(Evidence.EvidenceCertaintyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNote()) {
      composeAnnotation("note", element.getNote());
    }
    if (element.hasRating()) { 
      for (CodeableConcept e : element.getRating()) 
          composeCodeableConcept("rating", e);
    }
    if (element.hasCertaintySubcomponent()) { 
      for (Evidence.EvidenceCertaintyCertaintySubcomponentComponent e : element.getCertaintySubcomponent()) 
          composeEvidenceCertaintyCertaintySubcomponentComponent("certaintySubcomponent", e);
    }
  }

  protected void composeEvidenceCertaintyCertaintySubcomponentComponent(String name, Evidence.EvidenceCertaintyCertaintySubcomponentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceCertaintyCertaintySubcomponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceCertaintyCertaintySubcomponentComponentElements(Evidence.EvidenceCertaintyCertaintySubcomponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasNote()) {
      composeAnnotation("note", element.getNote());
    }
    if (element.hasType()) { 
      for (CodeableConcept e : element.getType()) 
          composeCodeableConcept("type", e);
    }
    if (element.hasRating()) { 
      for (CodeableConcept e : element.getRating()) 
          composeCodeableConcept("rating", e);
    }
  }

  protected void composeEvidenceFocus(String name, EvidenceFocus element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceFocusElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceFocusElements(EvidenceFocus element) throws IOException {
    composeMetadataResourceElements(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.hasUseContext()) { 
      for (UsageContext e : element.getUseContext()) 
          composeUsageContext("useContext", e);
    }
    if (element.hasDateElement()) {
      composeDateTime("date", element.getDateElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasCopyrightElement()) {
      composeMarkdown("copyright", element.getCopyrightElement());
    }
    if (element.hasCiteAs()) {
      composeReference("citeAs", element.getCiteAs());
    }
    if (element.hasCharacteristic()) { 
      for (EvidenceFocus.EvidenceFocusCharacteristicComponent e : element.getCharacteristic()) 
          composeEvidenceFocusCharacteristicComponent("characteristic", e);
    }
    if (element.hasRelatedArtifact()) { 
      for (RelatedArtifact e : element.getRelatedArtifact()) 
          composeRelatedArtifact("relatedArtifact", e);
    }
  }

  protected void composeEvidenceFocusCharacteristicComponent(String name, EvidenceFocus.EvidenceFocusCharacteristicComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceFocusCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceFocusCharacteristicComponentElements(EvidenceFocus.EvidenceFocusCharacteristicComponent 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 composeEvidenceVariable(String name, EvidenceVariable element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeEvidenceVariableElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeEvidenceVariableElements(EvidenceVariable element) throws IOException {
    composeMetadataResourceElements(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.hasActualElement()) {
      composeBoolean("actual", element.getActualElement());
    }
    if (element.hasCharacteristicCombinationElement())
      composeEnumeration("characteristicCombination", element.getCharacteristicCombinationElement(), new EvidenceVariable.CharacteristicCombinationEnumFactory());
    if (element.hasCharacteristic()) { 
      for (EvidenceVariable.EvidenceVariableCharacteristicComponent e : element.getCharacteristic()) 
          composeEvidenceVariableCharacteristicComponent("characteristic", e);
    }
  }

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

  protected void composeEvidenceVariableCharacteristicComponentElements(EvidenceVariable.EvidenceVariableCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasDefinition()) {
      composeType("definition", element.getDefinition());
    }    if (element.hasMethod()) {
      composeCodeableConcept("method", element.getMethod());
    }
    if (element.hasDevice()) {
      composeReference("device", element.getDevice());
    }
    if (element.hasExcludeElement()) {
      composeBoolean("exclude", element.getExcludeElement());
    }
    if (element.hasTimeFromStart()) {
      composeEvidenceVariableCharacteristicTimeFromStartComponent("timeFromStart", element.getTimeFromStart());
    }
    if (element.hasGroupMeasureElement())
      composeEnumeration("groupMeasure", element.getGroupMeasureElement(), new EvidenceVariable.GroupMeasureEnumFactory());
  }

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

  protected void composeEvidenceVariableCharacteristicTimeFromStartComponentElements(EvidenceVariable.EvidenceVariableCharacteristicTimeFromStartComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasRange()) {
      composeRange("range", element.getRange());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

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

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

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

  protected void composeExampleScenarioActorComponentElements(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 composeExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeExampleScenarioInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

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

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

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

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

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

  protected void composeExampleScenarioProcessComponentElements(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()) 
          composeExampleScenarioProcessStepComponent("step", e);
    }
  }

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

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

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

  protected void composeExampleScenarioProcessStepOperationComponentElements(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()) {
      composeExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
    }
    if (element.hasResponse()) {
      composeExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
    }
  }

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

  protected void composeExampleScenarioProcessStepAlternativeComponentElements(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()) 
          composeExampleScenarioProcessStepComponent("step", e);
    }
  }

  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.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 Enumerations.ClaimProcessingCodesEnumFactory());
    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) {
    composeResourceAttributes(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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasCondition()) { 
      for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
          composeFamilyMemberHistoryConditionComponent("condition", e);
    }
    if (element.hasProcedure()) { 
      for (FamilyMemberHistory.FamilyMemberHistoryProcedureComponent e : element.getProcedure()) 
          composeFamilyMemberHistoryProcedureComponent("procedure", e);
    }
  }

  protected void composeFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeFamilyMemberHistoryConditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeFamilyMemberHistoryConditionComponentElements(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 composeFamilyMemberHistoryProcedureComponent(String name, FamilyMemberHistory.FamilyMemberHistoryProcedureComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeFamilyMemberHistoryProcedureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeFamilyMemberHistoryProcedureComponentElements(FamilyMemberHistory.FamilyMemberHistoryProcedureComponent 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.hasPerformed()) {
      composeType("performed", element.getPerformed());
    }    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeFlag(String name, Flag element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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) {
    composeResourceAttributes(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.hasContinuousElement()) {
      composeBoolean("continuous", element.getContinuousElement());
    }
    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()) 
          composeGoalTargetComponent("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.hasOutcome()) { 
      for (CodeableReference e : element.getOutcome()) 
          composeCodeableReference("outcome", e);
    }
  }

  protected void composeGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGoalTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGoalTargetComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionElements(GraphDefinition element) throws IOException {
    composeCanonicalResourceElements(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()) 
          composeGraphDefinitionLinkComponent("link", e);
    }
  }

  protected void composeGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionLinkComponentElements(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()) 
          composeGraphDefinitionLinkTargetComponent("target", e);
    }
  }

  protected void composeGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionLinkTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionLinkTargetComponentElements(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()) 
          composeGraphDefinitionLinkTargetCompartmentComponent("compartment", e);
    }
    if (element.hasLink()) { 
      for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
          composeGraphDefinitionLinkComponent("link", e);
    }
  }

  protected void composeGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGraphDefinitionLinkTargetCompartmentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGraphDefinitionLinkTargetCompartmentComponentElements(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 Enumerations.CompartmentTypeEnumFactory());
    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) {
    composeResourceAttributes(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()) 
          composeGroupCharacteristicComponent("characteristic", e);
    }
    if (element.hasMember()) { 
      for (Group.GroupMemberComponent e : element.getMember()) 
          composeGroupMemberComponent("member", e);
    }
  }

  protected void composeGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGroupCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGroupCharacteristicComponentElements(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 composeGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeGroupMemberComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeGroupMemberComponentElements(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) {
    composeResourceAttributes(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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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) {
    composeResourceAttributes(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()) 
          composeHealthcareServiceEligibilityComponent("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()) 
          composeHealthcareServiceAvailableTimeComponent("availableTime", e);
    }
    if (element.hasNotAvailable()) { 
      for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
          composeHealthcareServiceNotAvailableComponent("notAvailable", e);
    }
    if (element.hasAvailabilityExceptionsElement()) {
      composeString("availabilityExceptions", element.getAvailabilityExceptionsElement());
    }
    if (element.hasEndpoint()) { 
      for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
    }
  }

  protected void composeHealthcareServiceEligibilityComponent(String name, HealthcareService.HealthcareServiceEligibilityComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHealthcareServiceEligibilityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

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

  protected void composeHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHealthcareServiceAvailableTimeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHealthcareServiceAvailableTimeComponentElements(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
    composeBackboneElementElements(element);
      if (element.hasDaysOfWeek()) 
        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
          composeEnumeration("daysOfWeek", e, new Enumerations.DaysOfWeekEnumFactory());
    if (element.hasAllDayElement()) {
      composeBoolean("allDay", element.getAllDayElement());
    }
    if (element.hasAvailableStartTimeElement()) {
      composeTime("availableStartTime", element.getAvailableStartTimeElement());
    }
    if (element.hasAvailableEndTimeElement()) {
      composeTime("availableEndTime", element.getAvailableEndTimeElement());
    }
  }

  protected void composeHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeHealthcareServiceNotAvailableComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeHealthcareServiceNotAvailableComponentElements(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) {
    composeResourceAttributes(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.hasProcedure()) { 
      for (ImagingStudy.ImagingStudyProcedureComponent e : element.getProcedure()) 
          composeImagingStudyProcedureComponent("procedure", e);
    }
    if (element.hasLocation()) {
      composeReference("location", element.getLocation());
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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()) 
          composeImagingStudySeriesComponent("series", e);
    }
  }

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

  protected void composeImagingStudyProcedureComponentElements(ImagingStudy.ImagingStudyProcedureComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

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

  protected void composeImagingStudySeriesComponentElements(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()) 
          composeImagingStudySeriesPerformerComponent("performer", e);
    }
    if (element.hasInstance()) { 
      for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
          composeImagingStudySeriesInstanceComponent("instance", e);
    }
  }

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

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

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

  protected void composeImagingStudySeriesInstanceComponentElements(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) {
    composeResourceAttributes(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.ImmunizationStatusCodesEnumFactory());
    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.hasInformationSource()) {
      composeType("informationSource", element.getInformationSource());
    }    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()) 
          composeImmunizationPerformerComponent("performer", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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()) 
          composeImmunizationEducationComponent("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()) 
          composeImmunizationReactionComponent("reaction", e);
    }
    if (element.hasProtocolApplied()) { 
      for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
          composeImmunizationProtocolAppliedComponent("protocolApplied", e);
    }
  }

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

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

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

  protected void composeImmunizationEducationComponentElements(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 composeImmunizationReactionComponent(String name, Immunization.ImmunizationReactionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationReactionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationReactionComponentElements(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 composeImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationProtocolAppliedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationProtocolAppliedComponentElements(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.hasDoseNumberElement()) {
      composeString("doseNumber", element.getDoseNumberElement());
    }
    if (element.hasSeriesDosesElement()) {
      composeString("seriesDoses", element.getSeriesDosesElement());
    }
  }

  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.ImmunizationEvaluationStatusCodesEnumFactory());
    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.hasDoseNumberElement()) {
      composeString("doseNumber", element.getDoseNumberElement());
    }
    if (element.hasSeriesDosesElement()) {
      composeString("seriesDoses", element.getSeriesDosesElement());
    }
  }

  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeImmunizationRecommendationRecommendationComponent("recommendation", e);
    }
  }

  protected void composeImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationRecommendationRecommendationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationRecommendationRecommendationComponentElements(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasVaccineCode()) { 
      for (CodeableConcept e : element.getVaccineCode()) 
          composeCodeableConcept("vaccineCode", e);
    }
    if (element.hasTargetDisease()) { 
      for (CodeableConcept e : element.getTargetDisease()) 
          composeCodeableConcept("targetDisease", e);
    }
    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()) 
          composeImmunizationRecommendationRecommendationDateCriterionComponent("dateCriterion", e);
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasSeriesElement()) {
      composeString("series", element.getSeriesElement());
    }
    if (element.hasDoseNumberElement()) {
      composeString("doseNumber", element.getDoseNumberElement());
    }
    if (element.hasSeriesDosesElement()) {
      composeString("seriesDoses", element.getSeriesDosesElement());
    }
    if (element.hasSupportingImmunization()) { 
      for (Reference e : element.getSupportingImmunization()) 
          composeReference("supportingImmunization", e);
    }
    if (element.hasSupportingPatientInformation()) { 
      for (Reference e : element.getSupportingPatientInformation()) 
          composeReference("supportingPatientInformation", e);
    }
  }

  protected void composeImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImmunizationRecommendationRecommendationDateCriterionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImmunizationRecommendationRecommendationDateCriterionComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideElements(ImplementationGuide element) throws IOException {
    composeCanonicalResourceElements(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<Enumerations.FHIRVersion> e : element.getFhirVersion()) 
          composeEnumeration("fhirVersion", e, new Enumerations.FHIRVersionEnumFactory());
    if (element.hasDependsOn()) { 
      for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
          composeImplementationGuideDependsOnComponent("dependsOn", e);
    }
    if (element.hasGlobal()) { 
      for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
          composeImplementationGuideGlobalComponent("global", e);
    }
    if (element.hasDefinition()) {
      composeImplementationGuideDefinitionComponent("definition", element.getDefinition());
    }
    if (element.hasManifest()) {
      composeImplementationGuideManifestComponent("manifest", element.getManifest());
    }
  }

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

  protected void composeImplementationGuideDependsOnComponentElements(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 composeImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideGlobalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideGlobalComponentElements(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement()) {
      composeCode("type", element.getTypeElement());
    }
    if (element.hasProfileElement()) {
      composeCanonical("profile", element.getProfileElement());
    }
  }

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

  protected void composeImplementationGuideDefinitionComponentElements(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasGrouping()) { 
      for (ImplementationGuide.ImplementationGuideDefinitionGroupingComponent e : element.getGrouping()) 
          composeImplementationGuideDefinitionGroupingComponent("grouping", e);
    }
    if (element.hasResource()) { 
      for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
          composeImplementationGuideDefinitionResourceComponent("resource", e);
    }
    if (element.hasPage()) {
      composeImplementationGuideDefinitionPageComponent("page", element.getPage());
    }
    if (element.hasParameter()) { 
      for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
          composeImplementationGuideDefinitionParameterComponent("parameter", e);
    }
    if (element.hasTemplate()) { 
      for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
          composeImplementationGuideDefinitionTemplateComponent("template", e);
    }
  }

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

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

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

  protected void composeImplementationGuideDefinitionResourceComponentElements(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasReference()) {
      composeReference("reference", element.getReference());
    }
      if (element.hasFhirVersion()) 
        for (Enumeration<Enumerations.FHIRVersion> 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 composeImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideDefinitionPageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideDefinitionPageComponentElements(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()) 
          composeImplementationGuideDefinitionPageComponent("page", e);
    }
  }

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

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

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

  protected void composeImplementationGuideDefinitionTemplateComponentElements(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 composeImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeImplementationGuideManifestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeImplementationGuideManifestComponentElements(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 composeIngredient(String name, Ingredient element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeIngredientElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeIngredientElements(Ingredient element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasFunction()) { 
      for (CodeableConcept e : element.getFunction()) 
          composeCodeableConcept("function", e);
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasAllergenicIndicatorElement()) {
      composeBoolean("allergenicIndicator", element.getAllergenicIndicatorElement());
    }
    if (element.hasManufacturer()) { 
      for (Reference e : element.getManufacturer()) 
          composeReference("manufacturer", e);
    }
    if (element.hasSpecifiedSubstance()) { 
      for (Ingredient.IngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
          composeIngredientSpecifiedSubstanceComponent("specifiedSubstance", e);
    }
    if (element.hasSubstance()) {
      composeIngredientSubstanceComponent("substance", element.getSubstance());
    }
  }

  protected void composeIngredientSpecifiedSubstanceComponent(String name, Ingredient.IngredientSpecifiedSubstanceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeIngredientSpecifiedSubstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeIngredientSpecifiedSubstanceComponentElements(Ingredient.IngredientSpecifiedSubstanceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeType("code", element.getCode());
    }    if (element.hasGroup()) {
      composeCodeableConcept("group", element.getGroup());
    }
    if (element.hasConfidentiality()) {
      composeCodeableConcept("confidentiality", element.getConfidentiality());
    }
    if (element.hasStrength()) { 
      for (Ingredient.IngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
          composeIngredientSpecifiedSubstanceStrengthComponent("strength", e);
    }
  }

  protected void composeIngredientSpecifiedSubstanceStrengthComponent(String name, Ingredient.IngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeIngredientSpecifiedSubstanceStrengthComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeIngredientSpecifiedSubstanceStrengthComponentElements(Ingredient.IngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPresentation()) {
      composeRatio("presentation", element.getPresentation());
    }
    if (element.hasPresentationHighLimit()) {
      composeRatio("presentationHighLimit", element.getPresentationHighLimit());
    }
    if (element.hasPresentationTextElement()) {
      composeString("presentationText", element.getPresentationTextElement());
    }
    if (element.hasConcentration()) {
      composeRatio("concentration", element.getConcentration());
    }
    if (element.hasConcentrationHighLimit()) {
      composeRatio("concentrationHighLimit", element.getConcentrationHighLimit());
    }
    if (element.hasConcentrationTextElement()) {
      composeString("concentrationText", element.getConcentrationTextElement());
    }
    if (element.hasMeasurementPointElement()) {
      composeString("measurementPoint", element.getMeasurementPointElement());
    }
    if (element.hasCountry()) { 
      for (CodeableConcept e : element.getCountry()) 
          composeCodeableConcept("country", e);
    }
    if (element.hasReferenceStrength()) { 
      for (Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
          composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent("referenceStrength", e);
    }
  }

  protected void composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentElements(Ingredient.IngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSubstance()) {
      composeType("substance", element.getSubstance());
    }    if (element.hasStrength()) {
      composeRatio("strength", element.getStrength());
    }
    if (element.hasStrengthHighLimit()) {
      composeRatio("strengthHighLimit", element.getStrengthHighLimit());
    }
    if (element.hasMeasurementPointElement()) {
      composeString("measurementPoint", element.getMeasurementPointElement());
    }
    if (element.hasCountry()) { 
      for (CodeableConcept e : element.getCountry()) 
          composeCodeableConcept("country", e);
    }
  }

  protected void composeIngredientSubstanceComponent(String name, Ingredient.IngredientSubstanceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeIngredientSubstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeIngredientSubstanceComponentElements(Ingredient.IngredientSubstanceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeType("code", element.getCode());
    }    if (element.hasStrength()) { 
      for (Ingredient.IngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
          composeIngredientSpecifiedSubstanceStrengthComponent("strength", e);
    }
  }

  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeInsurancePlanContactComponent("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()) 
          composeInsurancePlanCoverageComponent("coverage", e);
    }
    if (element.hasPlan()) { 
      for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
          composeInsurancePlanPlanComponent("plan", e);
    }
  }

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

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

  protected void composeInsurancePlanCoverageComponentElements(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 composeInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanPlanComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanPlanComponentElements(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()) 
          composeInsurancePlanPlanGeneralCostComponent("generalCost", e);
    }
    if (element.hasSpecificCost()) { 
      for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
          composeInsurancePlanPlanSpecificCostComponent("specificCost", e);
    }
  }

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

  protected void composeInsurancePlanPlanGeneralCostComponentElements(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 composeInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInsurancePlanPlanSpecificCostComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInsurancePlanPlanSpecificCostComponentElements(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) {
    composeResourceAttributes(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()) 
          composeInvoiceParticipantComponent("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()) 
          composeInvoiceLineItemComponent("lineItem", e);
    }
    if (element.hasTotalPriceComponent()) { 
      for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
          composeInvoiceLineItemPriceComponentComponent("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 composeInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInvoiceParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInvoiceParticipantComponentElements(Invoice.InvoiceParticipantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  protected void composeInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInvoiceLineItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInvoiceLineItemComponentElements(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()) 
          composeInvoiceLineItemPriceComponentComponent("priceComponent", e);
    }
  }

  protected void composeInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeInvoiceLineItemPriceComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeInvoiceLineItemPriceComponentComponentElements(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLibraryElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLibraryElements(Library element) throws IOException {
    composeMetadataResourceElements(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) {
    composeResourceAttributes(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()) 
          composeLinkageItemComponent("item", e);
    }
  }

  protected void composeLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLinkageItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLinkageItemComponentElements(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) {
    composeResourceAttributes(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 Enumerations.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.ListResourceEntryComponent e : element.getEntry()) 
          composeListResourceEntryComponent("entry", e);
    }
    if (element.hasEmptyReason()) {
      composeCodeableConcept("emptyReason", element.getEmptyReason());
    }
  }

  protected void composeListResourceEntryComponent(String name, ListResource.ListResourceEntryComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeListResourceEntryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeListResourceEntryComponentElements(ListResource.ListResourceEntryComponent 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) {
    composeResourceAttributes(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()) {
      composeLocationPositionComponent("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()) 
          composeLocationHoursOfOperationComponent("hoursOfOperation", e);
    }
    if (element.hasAvailabilityExceptionsElement()) {
      composeString("availabilityExceptions", element.getAvailabilityExceptionsElement());
    }
    if (element.hasEndpoint()) { 
      for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
    }
  }

  protected void composeLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLocationPositionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLocationPositionComponentElements(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 composeLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeLocationHoursOfOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeLocationHoursOfOperationComponentElements(Location.LocationHoursOfOperationComponent element) throws IOException {
    composeBackboneElementElements(element);
      if (element.hasDaysOfWeek()) 
        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
          composeEnumeration("daysOfWeek", e, new Enumerations.DaysOfWeekEnumFactory());
    if (element.hasAllDayElement()) {
      composeBoolean("allDay", element.getAllDayElement());
    }
    if (element.hasOpeningTimeElement()) {
      composeTime("openingTime", element.getOpeningTimeElement());
    }
    if (element.hasClosingTimeElement()) {
      composeTime("closingTime", element.getClosingTimeElement());
    }
  }

  protected void composeManufacturedItemDefinition(String name, ManufacturedItemDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeManufacturedItemDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeManufacturedItemDefinitionElements(ManufacturedItemDefinition element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasManufacturedDoseForm()) {
      composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
    }
    if (element.hasUnitOfPresentation()) {
      composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
    }
    if (element.hasManufacturer()) { 
      for (Reference e : element.getManufacturer()) 
          composeReference("manufacturer", e);
    }
    if (element.hasIngredient()) { 
      for (Reference e : element.getIngredient()) 
          composeReference("ingredient", e);
    }
    if (element.hasProperty()) { 
      for (ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent e : element.getProperty()) 
          composeManufacturedItemDefinitionPropertyComponent("property", e);
    }
  }

  protected void composeManufacturedItemDefinitionPropertyComponent(String name, ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeManufacturedItemDefinitionPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeManufacturedItemDefinitionPropertyComponentElements(ManufacturedItemDefinition.ManufacturedItemDefinitionPropertyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeMeasure(String name, Measure element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureElements(Measure element) throws IOException {
    composeMetadataResourceElements(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()) 
          composeMeasureGroupComponent("group", e);
    }
    if (element.hasSupplementalData()) { 
      for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
          composeMeasureSupplementalDataComponent("supplementalData", e);
    }
  }

  protected void composeMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureGroupComponentElements(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()) 
          composeMeasureGroupPopulationComponent("population", e);
    }
    if (element.hasStratifier()) { 
      for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
          composeMeasureGroupStratifierComponent("stratifier", e);
    }
  }

  protected void composeMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureGroupPopulationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureGroupPopulationComponentElements(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 composeMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureGroupStratifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureGroupStratifierComponentElements(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()) 
          composeMeasureGroupStratifierComponentComponent("component", e);
    }
  }

  protected void composeMeasureGroupStratifierComponentComponent(String name, Measure.MeasureGroupStratifierComponentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureGroupStratifierComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureGroupStratifierComponentComponentElements(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 composeMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureSupplementalDataComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureSupplementalDataComponentElements(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) {
    composeResourceAttributes(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()) 
          composeMeasureReportGroupComponent("group", e);
    }
    if (element.hasEvaluatedResource()) { 
      for (Reference e : element.getEvaluatedResource()) 
          composeReference("evaluatedResource", e);
    }
  }

  protected void composeMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportGroupComponentElements(MeasureReport.MeasureReportGroupComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasPopulation()) { 
      for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
          composeMeasureReportGroupPopulationComponent("population", e);
    }
    if (element.hasMeasureScore()) {
      composeQuantity("measureScore", element.getMeasureScore());
    }
    if (element.hasStratifier()) { 
      for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
          composeMeasureReportGroupStratifierComponent("stratifier", e);
    }
  }

  protected void composeMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportGroupPopulationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportGroupPopulationComponentElements(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 composeMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMeasureReportGroupStratifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMeasureReportGroupStratifierComponentElements(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 composeMedication(String name, Medication element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.MedicationStatusCodesEnumFactory());
    if (element.hasManufacturer()) {
      composeReference("manufacturer", element.getManufacturer());
    }
    if (element.hasDoseForm()) {
      composeCodeableConcept("doseForm", element.getDoseForm());
    }
    if (element.hasAmount()) {
      composeRatio("amount", element.getAmount());
    }
    if (element.hasIngredient()) { 
      for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
          composeMedicationIngredientComponent("ingredient", e);
    }
    if (element.hasBatch()) {
      composeMedicationBatchComponent("batch", element.getBatch());
    }
  }

  protected void composeMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationIngredientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationIngredientComponentElements(Medication.MedicationIngredientComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeCodeableReference("item", element.getItem());
    }
    if (element.hasIsActiveElement()) {
      composeBoolean("isActive", element.getIsActiveElement());
    }
    if (element.hasStrength()) {
      composeType("strength", element.getStrength());
    }  }

  protected void composeMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationBatchComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationBatchComponentElements(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) {
    composeResourceAttributes(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.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 MedicationAdministration.MedicationAdministrationStatusCodesEnumFactory());
    if (element.hasStatusReason()) { 
      for (CodeableConcept e : element.getStatusReason()) 
          composeCodeableConcept("statusReason", e);
    }
    if (element.hasCategory()) { 
      for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
    }
    if (element.hasMedication()) {
      composeCodeableReference("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.hasOccurence()) {
      composeType("occurence", element.getOccurence());
    }    if (element.hasRecordedElement()) {
      composeDateTime("recorded", element.getRecordedElement());
    }
    if (element.hasPerformer()) { 
      for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
          composeMedicationAdministrationPerformerComponent("performer", e);
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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()) {
      composeMedicationAdministrationDosageComponent("dosage", element.getDosage());
    }
    if (element.hasEventHistory()) { 
      for (Reference e : element.getEventHistory()) 
          composeReference("eventHistory", e);
    }
  }

  protected void composeMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationAdministrationPerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationAdministrationPerformerComponentElements(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  protected void composeMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationAdministrationDosageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationAdministrationDosageComponentElements(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) {
    composeResourceAttributes(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.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 MedicationDispense.MedicationDispenseStatusCodesEnumFactory());
    if (element.hasStatusReason()) {
      composeCodeableReference("statusReason", element.getStatusReason());
    }
    if (element.hasCategory()) { 
      for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
    }
    if (element.hasMedication()) {
      composeCodeableReference("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.hasPerformer()) { 
      for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
          composeMedicationDispensePerformerComponent("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.hasRenderedDosageInstructionElement()) {
      composeString("renderedDosageInstruction", element.getRenderedDosageInstructionElement());
    }
    if (element.hasDosageInstruction()) { 
      for (Dosage e : element.getDosageInstruction()) 
          composeDosage("dosageInstruction", e);
    }
    if (element.hasSubstitution()) {
      composeMedicationDispenseSubstitutionComponent("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 composeMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationDispensePerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationDispensePerformerComponentElements(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  protected void composeMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationDispenseSubstitutionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationDispenseSubstitutionComponentElements(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()) {
      composeReference("responsibleParty", element.getResponsibleParty());
    }
  }

  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory());
    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()) 
          composeMedicationKnowledgeRelatedMedicationKnowledgeComponent("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()) 
          composeMedicationKnowledgeMonographComponent("monograph", e);
    }
    if (element.hasIngredient()) { 
      for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
          composeMedicationKnowledgeIngredientComponent("ingredient", e);
    }
    if (element.hasDevice()) { 
      for (Reference e : element.getDevice()) 
          composeReference("device", 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()) 
          composeMedicationKnowledgeCostComponent("cost", e);
    }
    if (element.hasMonitoringProgram()) { 
      for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
          composeMedicationKnowledgeMonitoringProgramComponent("monitoringProgram", e);
    }
    if (element.hasAdministrationGuideline()) { 
      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent e : element.getAdministrationGuideline()) 
          composeMedicationKnowledgeAdministrationGuidelineComponent("administrationGuideline", e);
    }
    if (element.hasMedicineClassification()) { 
      for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
          composeMedicationKnowledgeMedicineClassificationComponent("medicineClassification", e);
    }
    if (element.hasPackaging()) {
      composeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
    }
    if (element.hasDrugCharacteristic()) { 
      for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
          composeMedicationKnowledgeDrugCharacteristicComponent("drugCharacteristic", e);
    }
    if (element.hasClinicalUseIssue()) { 
      for (Reference e : element.getClinicalUseIssue()) 
          composeReference("clinicalUseIssue", e);
    }
    if (element.hasRegulatory()) { 
      for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
          composeMedicationKnowledgeRegulatoryComponent("regulatory", e);
    }
    if (element.hasKineticCharacteristic()) { 
      for (MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent e : element.getKineticCharacteristic()) 
          composeMedicationKnowledgeKineticCharacteristicComponent("kineticCharacteristic", e);
    }
  }

  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeRelatedMedicationKnowledgeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeRelatedMedicationKnowledgeComponentElements(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 composeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMonographComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMonographComponentElements(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasSource()) {
      composeReference("source", element.getSource());
    }
  }

  protected void composeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeIngredientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeIngredientComponentElements(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeCodeableReference("item", element.getItem());
    }
    if (element.hasIsActiveElement()) {
      composeBoolean("isActive", element.getIsActiveElement());
    }
    if (element.hasStrength()) {
      composeType("strength", element.getStrength());
    }  }

  protected void composeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeCostComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeCostComponentElements(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 composeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMonitoringProgramComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMonitoringProgramComponentElements(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
  }

  protected void composeMedicationKnowledgeAdministrationGuidelineComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeAdministrationGuidelineComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeAdministrationGuidelineComponentElements(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDosage()) { 
      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent e : element.getDosage()) 
          composeMedicationKnowledgeAdministrationGuidelineDosageComponent("dosage", e);
    }
    if (element.hasIndication()) {
      composeCodeableReference("indication", element.getIndication());
    }
    if (element.hasPatientCharacteristic()) { 
      for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent e : element.getPatientCharacteristic()) 
          composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent("patientCharacteristic", e);
    }
  }

  protected void composeMedicationKnowledgeAdministrationGuidelineDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeAdministrationGuidelineDosageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeAdministrationGuidelineDosageComponentElements(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelineDosageComponent 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 composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponentElements(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinePatientCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeMedicineClassificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeMedicineClassificationComponentElements(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 composeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgePackagingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgePackagingComponentElements(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasDevice()) {
      composeReference("device", element.getDevice());
    }
    if (element.hasMaterial()) {
      composeCodeableConcept("material", element.getMaterial());
    }
    if (element.hasPackaging()) { 
      for (MedicationKnowledge.MedicationKnowledgePackagingComponent e : element.getPackaging()) 
          composeMedicationKnowledgePackagingComponent("packaging", e);
    }
  }

  protected void composeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeDrugCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeDrugCharacteristicComponentElements(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeRegulatoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeRegulatoryComponentElements(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRegulatoryAuthority()) {
      composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
    }
    if (element.hasSubstitution()) { 
      for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
          composeMedicationKnowledgeRegulatorySubstitutionComponent("substitution", e);
    }
    if (element.hasSchedule()) { 
      for (CodeableConcept e : element.getSchedule()) 
          composeCodeableConcept("schedule", e);
    }
    if (element.hasMaxDispense()) {
      composeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
    }
  }

  protected void composeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeRegulatorySubstitutionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeRegulatorySubstitutionComponentElements(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasAllowedElement()) {
      composeBoolean("allowed", element.getAllowedElement());
    }
  }

  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeRegulatoryMaxDispenseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeRegulatoryMaxDispenseComponentElements(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasPeriod()) {
      composeDuration("period", element.getPeriod());
    }
  }

  protected void composeMedicationKnowledgeKineticCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationKnowledgeKineticCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationKnowledgeKineticCharacteristicComponentElements(MedicationKnowledge.MedicationKnowledgeKineticCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.RequestPriorityEnumFactory());
    if (element.hasDoNotPerformElement()) {
      composeBoolean("doNotPerform", element.getDoNotPerformElement());
    }
    if (element.hasReportedElement()) {
      composeBoolean("reported", element.getReportedElement());
    }
    if (element.hasInformationSource()) {
      composeReference("informationSource", element.getInformationSource());
    }
    if (element.hasMedication()) {
      composeCodeableReference("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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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.hasRenderedDosageInstructionElement()) {
      composeString("renderedDosageInstruction", element.getRenderedDosageInstructionElement());
    }
    if (element.hasDosageInstruction()) { 
      for (Dosage e : element.getDosageInstruction()) 
          composeDosage("dosageInstruction", e);
    }
    if (element.hasDispenseRequest()) {
      composeMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
    }
    if (element.hasSubstitution()) {
      composeMedicationRequestSubstitutionComponent("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 composeMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestDispenseRequestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestDispenseRequestComponentElements(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasInitialFill()) {
      composeMedicationRequestDispenseRequestInitialFillComponent("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.hasDispenser()) {
      composeReference("dispenser", element.getDispenser());
    }
  }

  protected void composeMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestDispenseRequestInitialFillComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestDispenseRequestInitialFillComponentElements(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasDuration()) {
      composeDuration("duration", element.getDuration());
    }
  }

  protected void composeMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationRequestSubstitutionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationRequestSubstitutionComponentElements(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAllowed()) {
      composeType("allowed", element.getAllowed());
    }    if (element.hasReason()) {
      composeCodeableConcept("reason", element.getReason());
    }
  }

  protected void composeMedicationUsage(String name, MedicationUsage element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicationUsageElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicationUsageElements(MedicationUsage 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 MedicationUsage.MedicationUsageStatusCodesEnumFactory());
    if (element.hasStatusReason()) { 
      for (CodeableConcept e : element.getStatusReason()) 
          composeCodeableConcept("statusReason", e);
    }
    if (element.hasCategory()) { 
      for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
    }
    if (element.hasMedication()) {
      composeCodeableReference("medication", element.getMedication());
    }
    if (element.hasSubject()) {
      composeReference("subject", element.getSubject());
    }
    if (element.hasEncounter()) {
      composeReference("encounter", element.getEncounter());
    }
    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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasRenderedDosageInstructionElement()) {
      composeString("renderedDosageInstruction", element.getRenderedDosageInstructionElement());
    }
    if (element.hasDosage()) { 
      for (Dosage e : element.getDosage()) 
          composeDosage("dosage", e);
    }
    if (element.hasTakenAsOrderedElement()) {
      composeBoolean("takenAsOrdered", element.getTakenAsOrderedElement());
    }
  }

  protected void composeMedicinalProductDefinition(String name, MedicinalProductDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductDefinitionElements(MedicinalProductDefinition 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()) {
      composeCodeableConcept("domain", element.getDomain());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasStatusDateElement()) {
      composeDateTime("statusDate", element.getStatusDateElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasCombinedPharmaceuticalDoseForm()) {
      composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
    }
    if (element.hasIndicationElement()) {
      composeMarkdown("indication", element.getIndicationElement());
    }
    if (element.hasLegalStatusOfSupply()) {
      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
    }
    if (element.hasAdditionalMonitoringIndicator()) {
      composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
    }
    if (element.hasSpecialMeasures()) { 
      for (CodeableConcept e : element.getSpecialMeasures()) 
          composeCodeableConcept("specialMeasures", e);
    }
    if (element.hasPaediatricUseIndicator()) {
      composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
    }
    if (element.hasProductClassification()) { 
      for (CodeableConcept e : element.getProductClassification()) 
          composeCodeableConcept("productClassification", e);
    }
    if (element.hasCharacteristic()) { 
      for (CodeableConcept e : element.getCharacteristic()) 
          composeCodeableConcept("characteristic", 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.hasIngredient()) { 
      for (Reference e : element.getIngredient()) 
          composeReference("ingredient", 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 (MedicinalProductDefinition.MedicinalProductDefinitionContactComponent e : element.getContact()) 
          composeMedicinalProductDefinitionContactComponent("contact", e);
    }
    if (element.hasClinicalTrial()) { 
      for (Reference e : element.getClinicalTrial()) 
          composeReference("clinicalTrial", e);
    }
    if (element.hasName()) { 
      for (MedicinalProductDefinition.MedicinalProductDefinitionNameComponent e : element.getName()) 
          composeMedicinalProductDefinitionNameComponent("name", e);
    }
    if (element.hasCrossReference()) { 
      for (MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent e : element.getCrossReference()) 
          composeMedicinalProductDefinitionCrossReferenceComponent("crossReference", e);
    }
    if (element.hasManufacturingBusinessOperation()) { 
      for (MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
          composeMedicinalProductDefinitionManufacturingBusinessOperationComponent("manufacturingBusinessOperation", e);
    }
  }

  protected void composeMedicinalProductDefinitionContactComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductDefinitionContactComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductDefinitionContactComponentElements(MedicinalProductDefinition.MedicinalProductDefinitionContactComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasContact()) {
      composeReference("contact", element.getContact());
    }
  }

  protected void composeMedicinalProductDefinitionNameComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductDefinitionNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductDefinitionNameComponentElements(MedicinalProductDefinition.MedicinalProductDefinitionNameComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProductNameElement()) {
      composeString("productName", element.getProductNameElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasNamePart()) { 
      for (MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent e : element.getNamePart()) 
          composeMedicinalProductDefinitionNameNamePartComponent("namePart", e);
    }
    if (element.hasCountryLanguage()) { 
      for (MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent e : element.getCountryLanguage()) 
          composeMedicinalProductDefinitionNameCountryLanguageComponent("countryLanguage", e);
    }
  }

  protected void composeMedicinalProductDefinitionNameNamePartComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductDefinitionNameNamePartComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductDefinitionNameNamePartComponentElements(MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPartElement()) {
      composeString("part", element.getPartElement());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
  }

  protected void composeMedicinalProductDefinitionNameCountryLanguageComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductDefinitionNameCountryLanguageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductDefinitionNameCountryLanguageComponentElements(MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent 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 composeMedicinalProductDefinitionCrossReferenceComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductDefinitionCrossReferenceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductDefinitionCrossReferenceComponentElements(MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasProduct()) {
      composeType("product", element.getProduct());
    }    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
  }

  protected void composeMedicinalProductDefinitionManufacturingBusinessOperationComponent(String name, MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMedicinalProductDefinitionManufacturingBusinessOperationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMedicinalProductDefinitionManufacturingBusinessOperationComponentElements(MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableReference("type", element.getType());
    }
    if (element.hasEffectiveDate()) {
      composePeriod("effectiveDate", element.getEffectiveDate());
    }
    if (element.hasManufacturer()) { 
      for (Reference e : element.getManufacturer()) 
          composeReference("manufacturer", e);
    }
    if (element.hasAuthorization()) {
      composeReference("authorization", element.getAuthorization());
    }
    if (element.hasConfidentialityIndicator()) {
      composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
    }
  }

  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageDefinitionElements(MessageDefinition element) throws IOException {
    composeCanonicalResourceElements(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()) 
          composeMessageDefinitionFocusComponent("focus", e);
    }
    if (element.hasResponseRequiredElement())
      composeEnumeration("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory());
    if (element.hasAllowedResponse()) { 
      for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
          composeMessageDefinitionAllowedResponseComponent("allowedResponse", e);
    }
    if (element.hasGraph()) { 
      for (CanonicalType e : element.getGraph()) 
          composeCanonical("graph", e);
    }
  }

  protected void composeMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageDefinitionFocusComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageDefinitionFocusComponentElements(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 composeMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageDefinitionAllowedResponseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageDefinitionAllowedResponseComponentElements(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) {
    composeResourceAttributes(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()) {
      composeMessageHeaderResponseComponent("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 composeMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMessageHeaderResponseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMessageHeaderResponseComponentElements(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) {
    composeResourceAttributes(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()) {
      composeMolecularSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
    }
    if (element.hasVariant()) { 
      for (MolecularSequence.MolecularSequenceVariantComponent e : element.getVariant()) 
          composeMolecularSequenceVariantComponent("variant", e);
    }
    if (element.hasObservedSeqElement()) {
      composeString("observedSeq", element.getObservedSeqElement());
    }
    if (element.hasQuality()) { 
      for (MolecularSequence.MolecularSequenceQualityComponent e : element.getQuality()) 
          composeMolecularSequenceQualityComponent("quality", e);
    }
    if (element.hasReadCoverageElement()) {
      composeInteger("readCoverage", element.getReadCoverageElement());
    }
    if (element.hasRepository()) { 
      for (MolecularSequence.MolecularSequenceRepositoryComponent e : element.getRepository()) 
          composeMolecularSequenceRepositoryComponent("repository", e);
    }
    if (element.hasPointer()) { 
      for (Reference e : element.getPointer()) 
          composeReference("pointer", e);
    }
    if (element.hasStructureVariant()) { 
      for (MolecularSequence.MolecularSequenceStructureVariantComponent e : element.getStructureVariant()) 
          composeMolecularSequenceStructureVariantComponent("structureVariant", e);
    }
  }

  protected void composeMolecularSequenceReferenceSeqComponent(String name, MolecularSequence.MolecularSequenceReferenceSeqComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceReferenceSeqComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceReferenceSeqComponentElements(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 composeMolecularSequenceVariantComponent(String name, MolecularSequence.MolecularSequenceVariantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceVariantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceVariantComponentElements(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 composeMolecularSequenceQualityComponent(String name, MolecularSequence.MolecularSequenceQualityComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceQualityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceQualityComponentElements(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()) {
      composeMolecularSequenceQualityRocComponent("roc", element.getRoc());
    }
  }

  protected void composeMolecularSequenceQualityRocComponent(String name, MolecularSequence.MolecularSequenceQualityRocComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceQualityRocComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceQualityRocComponentElements(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 composeMolecularSequenceRepositoryComponent(String name, MolecularSequence.MolecularSequenceRepositoryComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceRepositoryComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceRepositoryComponentElements(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 composeMolecularSequenceStructureVariantComponent(String name, MolecularSequence.MolecularSequenceStructureVariantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceStructureVariantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceStructureVariantComponentElements(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()) {
      composeMolecularSequenceStructureVariantOuterComponent("outer", element.getOuter());
    }
    if (element.hasInner()) {
      composeMolecularSequenceStructureVariantInnerComponent("inner", element.getInner());
    }
  }

  protected void composeMolecularSequenceStructureVariantOuterComponent(String name, MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceStructureVariantOuterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceStructureVariantOuterComponentElements(MolecularSequence.MolecularSequenceStructureVariantOuterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasStartElement()) {
      composeInteger("start", element.getStartElement());
    }
    if (element.hasEndElement()) {
      composeInteger("end", element.getEndElement());
    }
  }

  protected void composeMolecularSequenceStructureVariantInnerComponent(String name, MolecularSequence.MolecularSequenceStructureVariantInnerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeMolecularSequenceStructureVariantInnerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeMolecularSequenceStructureVariantInnerComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNamingSystemElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNamingSystemElements(NamingSystem element) throws IOException {
    composeCanonicalResourceElements(element);
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory());
    if (element.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new 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()) 
          composeNamingSystemUniqueIdComponent("uniqueId", e);
    }
  }

  protected void composeNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNamingSystemUniqueIdComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNamingSystemUniqueIdComponentElements(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 composeNutritionIntake(String name, NutritionIntake element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionIntakeElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionIntakeElements(NutritionIntake 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 Enumerations.EventStatusEnumFactory());
    if (element.hasStatusReason()) { 
      for (CodeableConcept e : element.getStatusReason()) 
          composeCodeableConcept("statusReason", e);
    }
    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.hasRecordedElement()) {
      composeDateTime("recorded", element.getRecordedElement());
    }
    if (element.hasReported()) {
      composeType("reported", element.getReported());
    }    if (element.hasConsumedItem()) { 
      for (NutritionIntake.NutritionIntakeConsumedItemComponent e : element.getConsumedItem()) 
          composeNutritionIntakeConsumedItemComponent("consumedItem", e);
    }
    if (element.hasIngredientLabel()) { 
      for (NutritionIntake.NutritionIntakeIngredientLabelComponent e : element.getIngredientLabel()) 
          composeNutritionIntakeIngredientLabelComponent("ingredientLabel", e);
    }
    if (element.hasPerformer()) { 
      for (NutritionIntake.NutritionIntakePerformerComponent e : element.getPerformer()) 
          composeNutritionIntakePerformerComponent("performer", e);
    }
    if (element.hasLocation()) {
      composeReference("location", element.getLocation());
    }
    if (element.hasDerivedFrom()) { 
      for (Reference e : element.getDerivedFrom()) 
          composeReference("derivedFrom", e);
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeNutritionIntakeConsumedItemComponent(String name, NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionIntakeConsumedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionIntakeConsumedItemComponentElements(NutritionIntake.NutritionIntakeConsumedItemComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasNutritionProduct()) {
      composeCodeableReference("nutritionProduct", element.getNutritionProduct());
    }
    if (element.hasSchedule()) {
      composeTiming("schedule", element.getSchedule());
    }
    if (element.hasAmount()) {
      composeQuantity("amount", element.getAmount());
    }
    if (element.hasRate()) {
      composeQuantity("rate", element.getRate());
    }
    if (element.hasNotConsumedElement()) {
      composeBoolean("notConsumed", element.getNotConsumedElement());
    }
    if (element.hasNotConsumedReason()) {
      composeCodeableConcept("notConsumedReason", element.getNotConsumedReason());
    }
  }

  protected void composeNutritionIntakeIngredientLabelComponent(String name, NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionIntakeIngredientLabelComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionIntakeIngredientLabelComponentElements(NutritionIntake.NutritionIntakeIngredientLabelComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNutrient()) {
      composeCodeableReference("nutrient", element.getNutrient());
    }
    if (element.hasAmount()) {
      composeQuantity("amount", element.getAmount());
    }
  }

  protected void composeNutritionIntakePerformerComponent(String name, NutritionIntake.NutritionIntakePerformerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionIntakePerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionIntakePerformerComponentElements(NutritionIntake.NutritionIntakePerformerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFunction()) {
      composeCodeableConcept("function", element.getFunction());
    }
    if (element.hasActor()) {
      composeReference("actor", element.getActor());
    }
  }

  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.RequestStatusEnumFactory());
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory());
    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()) {
      composeNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
    }
    if (element.hasSupplement()) { 
      for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
          composeNutritionOrderSupplementComponent("supplement", e);
    }
    if (element.hasEnteralFormula()) {
      composeNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderOralDietComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderOralDietComponentElements(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()) 
          composeNutritionOrderOralDietNutrientComponent("nutrient", e);
    }
    if (element.hasTexture()) { 
      for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
          composeNutritionOrderOralDietTextureComponent("texture", e);
    }
    if (element.hasFluidConsistencyType()) { 
      for (CodeableConcept e : element.getFluidConsistencyType()) 
          composeCodeableConcept("fluidConsistencyType", e);
    }
    if (element.hasInstructionElement()) {
      composeString("instruction", element.getInstructionElement());
    }
  }

  protected void composeNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderOralDietNutrientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderOralDietNutrientComponentElements(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasModifier()) {
      composeCodeableConcept("modifier", element.getModifier());
    }
    if (element.hasAmount()) {
      composeQuantity("amount", element.getAmount());
    }
  }

  protected void composeNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderOralDietTextureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderOralDietTextureComponentElements(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasModifier()) {
      composeCodeableConcept("modifier", element.getModifier());
    }
    if (element.hasFoodType()) {
      composeCodeableConcept("foodType", element.getFoodType());
    }
  }

  protected void composeNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderSupplementComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderSupplementComponentElements(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 composeNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderEnteralFormulaComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderEnteralFormulaComponentElements(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()) 
          composeNutritionOrderEnteralFormulaAdministrationComponent("administration", e);
    }
    if (element.hasMaxVolumeToDeliver()) {
      composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
    }
    if (element.hasAdministrationInstructionElement()) {
      composeString("administrationInstruction", element.getAdministrationInstructionElement());
    }
  }

  protected void composeNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionOrderEnteralFormulaAdministrationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionOrderEnteralFormulaAdministrationComponentElements(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 composeNutritionProduct(String name, NutritionProduct element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionProductElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionProductElements(NutritionProduct element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new NutritionProduct.NutritionProductStatusEnumFactory());
    if (element.hasCategory()) { 
      for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasManufacturer()) { 
      for (Reference e : element.getManufacturer()) 
          composeReference("manufacturer", e);
    }
    if (element.hasNutrient()) { 
      for (NutritionProduct.NutritionProductNutrientComponent e : element.getNutrient()) 
          composeNutritionProductNutrientComponent("nutrient", e);
    }
    if (element.hasIngredient()) { 
      for (NutritionProduct.NutritionProductIngredientComponent e : element.getIngredient()) 
          composeNutritionProductIngredientComponent("ingredient", e);
    }
    if (element.hasKnownAllergen()) { 
      for (CodeableReference e : element.getKnownAllergen()) 
          composeCodeableReference("knownAllergen", e);
    }
    if (element.hasProductCharacteristic()) { 
      for (NutritionProduct.NutritionProductProductCharacteristicComponent e : element.getProductCharacteristic()) 
          composeNutritionProductProductCharacteristicComponent("productCharacteristic", e);
    }
    if (element.hasInstance()) {
      composeNutritionProductInstanceComponent("instance", element.getInstance());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeNutritionProductNutrientComponent(String name, NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionProductNutrientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionProductNutrientComponentElements(NutritionProduct.NutritionProductNutrientComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeCodeableReference("item", element.getItem());
    }
    if (element.hasAmount()) { 
      for (Ratio e : element.getAmount()) 
          composeRatio("amount", e);
    }
  }

  protected void composeNutritionProductIngredientComponent(String name, NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionProductIngredientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionProductIngredientComponentElements(NutritionProduct.NutritionProductIngredientComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) {
      composeCodeableReference("item", element.getItem());
    }
    if (element.hasAmount()) { 
      for (Ratio e : element.getAmount()) 
          composeRatio("amount", e);
    }
  }

  protected void composeNutritionProductProductCharacteristicComponent(String name, NutritionProduct.NutritionProductProductCharacteristicComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionProductProductCharacteristicComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionProductProductCharacteristicComponentElements(NutritionProduct.NutritionProductProductCharacteristicComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeNutritionProductInstanceComponent(String name, NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeNutritionProductInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeNutritionProductInstanceComponentElements(NutritionProduct.NutritionProductInstanceComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasLotNumberElement()) {
      composeString("lotNumber", element.getLotNumberElement());
    }
    if (element.hasExpiryElement()) {
      composeDateTime("expiry", element.getExpiryElement());
    }
    if (element.hasUseByElement()) {
      composeDateTime("useBy", element.getUseByElement());
    }
  }

  protected void composeObservation(String name, Observation element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.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()) 
          composeObservationReferenceRangeComponent("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()) 
          composeObservationComponentComponent("component", e);
    }
  }

  protected void composeObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationReferenceRangeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationReferenceRangeComponentElements(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 composeObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationComponentComponentElements(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()) 
          composeObservationReferenceRangeComponent("referenceRange", e);
    }
  }

  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasDerivedFromCanonical()) { 
      for (CanonicalType e : element.getDerivedFromCanonical()) 
          composeCanonical("derivedFromCanonical", e);
    }
    if (element.hasDerivedFromUri()) { 
      for (UriType e : element.getDerivedFromUri()) 
          composeUri("derivedFromUri", e);
    }
    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.hasPublisher()) {
      composeReference("publisher", element.getPublisher());
    }
    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.hasPerformerType()) {
      composeCodeableConcept("performerType", element.getPerformerType());
    }
    if (element.hasCategory()) { 
      for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
    }
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
      if (element.hasPermittedDataType()) 
        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
          composeEnumeration("permittedDataType", e, new ObservationDefinition.ObservationDataTypeEnumFactory());
    if (element.hasMultipleResultsAllowedElement()) {
      composeBoolean("multipleResultsAllowed", element.getMultipleResultsAllowedElement());
    }
    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.hasPreferredReportNameElement()) {
      composeString("preferredReportName", element.getPreferredReportNameElement());
    }
    if (element.hasQuantitativeDetails()) {
      composeObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
    }
    if (element.hasQualifiedInterval()) { 
      for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
          composeObservationDefinitionQualifiedIntervalComponent("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());
    }
    if (element.hasHasMember()) { 
      for (Reference e : element.getHasMember()) 
          composeReference("hasMember", e);
    }
    if (element.hasComponent()) { 
      for (ObservationDefinition.ObservationDefinitionComponentComponent e : element.getComponent()) 
          composeObservationDefinitionComponentComponent("component", e);
    }
  }

  protected void composeObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationDefinitionQuantitativeDetailsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationDefinitionQuantitativeDetailsComponentElements(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 composeObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationDefinitionQualifiedIntervalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationDefinitionQualifiedIntervalComponentElements(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 composeObservationDefinitionComponentComponent(String name, ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeObservationDefinitionComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeObservationDefinitionComponentComponentElements(ObservationDefinition.ObservationDefinitionComponentComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
      if (element.hasPermittedDataType()) 
        for (Enumeration<ObservationDefinition.ObservationDataType> e : element.getPermittedDataType()) 
          composeEnumeration("permittedDataType", e, new ObservationDefinition.ObservationDataTypeEnumFactory());
    if (element.hasQuantitativeDetails()) {
      composeObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
    }
    if (element.hasQualifiedInterval()) { 
      for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
          composeObservationDefinitionQualifiedIntervalComponent("qualifiedInterval", e);
    }
  }

  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionElements(OperationDefinition element) throws IOException {
    composeCanonicalResourceElements(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()) 
          composeOperationDefinitionParameterComponent("parameter", e);
    }
    if (element.hasOverload()) { 
      for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
          composeOperationDefinitionOverloadComponent("overload", e);
    }
  }

  protected void composeOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionParameterComponentElements(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeCode("name", element.getNameElement());
    }
    if (element.hasUseElement())
      composeEnumeration("use", element.getUseElement(), new Enumerations.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())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.FHIRAllTypesEnumFactory());
    if (element.hasTargetProfile()) { 
      for (CanonicalType e : element.getTargetProfile()) 
          composeCanonical("targetProfile", e);
    }
    if (element.hasSearchTypeElement())
      composeEnumeration("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory());
    if (element.hasBinding()) {
      composeOperationDefinitionParameterBindingComponent("binding", element.getBinding());
    }
    if (element.hasReferencedFrom()) { 
      for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
          composeOperationDefinitionParameterReferencedFromComponent("referencedFrom", e);
    }
    if (element.hasPart()) { 
      for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
          composeOperationDefinitionParameterComponent("part", e);
    }
  }

  protected void composeOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionParameterBindingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionParameterBindingComponentElements(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 composeOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionParameterReferencedFromComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionParameterReferencedFromComponentElements(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSourceElement()) {
      composeString("source", element.getSourceElement());
    }
    if (element.hasSourceIdElement()) {
      composeString("sourceId", element.getSourceIdElement());
    }
  }

  protected void composeOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationDefinitionOverloadComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationDefinitionOverloadComponentElements(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) {
    composeResourceAttributes(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()) 
          composeOperationOutcomeIssueComponent("issue", e);
    }
  }

  protected void composeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOperationOutcomeIssueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOperationOutcomeIssueComponentElements(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) {
    composeResourceAttributes(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()) 
          composeOrganizationContactComponent("contact", e);
    }
    if (element.hasEndpoint()) { 
      for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
    }
  }

  protected void composeOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeOrganizationContactComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeOrganizationContactComponentElements(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) {
    composeResourceAttributes(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 composePackagedProductDefinition(String name, PackagedProductDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePackagedProductDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePackagedProductDefinitionElements(PackagedProductDefinition element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasSubject()) { 
      for (Reference e : element.getSubject()) 
          composeReference("subject", e);
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasStatusDateElement()) {
      composeDateTime("statusDate", element.getStatusDateElement());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasLegalStatusOfSupply()) {
      composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
    }
    if (element.hasMarketingStatus()) { 
      for (MarketingStatus e : element.getMarketingStatus()) 
          composeMarketingStatus("marketingStatus", e);
    }
    if (element.hasCharacteristic()) { 
      for (CodeableConcept e : element.getCharacteristic()) 
          composeCodeableConcept("characteristic", e);
    }
    if (element.hasCopackagedIndicatorElement()) {
      composeBoolean("copackagedIndicator", element.getCopackagedIndicatorElement());
    }
    if (element.hasMarketingAuthorization()) {
      composeReference("marketingAuthorization", element.getMarketingAuthorization());
    }
    if (element.hasManufacturer()) { 
      for (Reference e : element.getManufacturer()) 
          composeReference("manufacturer", e);
    }
    if (element.hasBatchIdentifier()) { 
      for (PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent e : element.getBatchIdentifier()) 
          composePackagedProductDefinitionBatchIdentifierComponent("batchIdentifier", e);
    }
    if (element.hasPackage()) { 
      for (PackagedProductDefinition.PackagedProductDefinitionPackageComponent e : element.getPackage()) 
          composePackagedProductDefinitionPackageComponent("package", e);
    }
  }

  protected void composePackagedProductDefinitionBatchIdentifierComponent(String name, PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePackagedProductDefinitionBatchIdentifierComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePackagedProductDefinitionBatchIdentifierComponentElements(PackagedProductDefinition.PackagedProductDefinitionBatchIdentifierComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasOuterPackaging()) {
      composeIdentifier("outerPackaging", element.getOuterPackaging());
    }
    if (element.hasImmediatePackaging()) {
      composeIdentifier("immediatePackaging", element.getImmediatePackaging());
    }
  }

  protected void composePackagedProductDefinitionPackageComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePackagedProductDefinitionPackageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePackagedProductDefinitionPackageComponentElements(PackagedProductDefinition.PackagedProductDefinitionPackageComponent 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.hasQuantityElement()) {
      composeInteger("quantity", element.getQuantityElement());
    }
    if (element.hasMaterial()) { 
      for (CodeableConcept e : element.getMaterial()) 
          composeCodeableConcept("material", e);
    }
    if (element.hasAlternateMaterial()) { 
      for (CodeableConcept e : element.getAlternateMaterial()) 
          composeCodeableConcept("alternateMaterial", e);
    }
    if (element.hasShelfLifeStorage()) { 
      for (ProductShelfLife e : element.getShelfLifeStorage()) 
          composeProductShelfLife("shelfLifeStorage", e);
    }
    if (element.hasManufacturer()) { 
      for (Reference e : element.getManufacturer()) 
          composeReference("manufacturer", e);
    }
    if (element.hasProperty()) { 
      for (PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent e : element.getProperty()) 
          composePackagedProductDefinitionPackagePropertyComponent("property", e);
    }
    if (element.hasContainedItem()) { 
      for (PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent e : element.getContainedItem()) 
          composePackagedProductDefinitionPackageContainedItemComponent("containedItem", e);
    }
    if (element.hasPackage()) { 
      for (PackagedProductDefinition.PackagedProductDefinitionPackageComponent e : element.getPackage()) 
          composePackagedProductDefinitionPackageComponent("package", e);
    }
  }

  protected void composePackagedProductDefinitionPackagePropertyComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePackagedProductDefinitionPackagePropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePackagedProductDefinitionPackagePropertyComponentElements(PackagedProductDefinition.PackagedProductDefinitionPackagePropertyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composePackagedProductDefinitionPackageContainedItemComponent(String name, PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePackagedProductDefinitionPackageContainedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePackagedProductDefinitionPackageContainedItemComponentElements(PackagedProductDefinition.PackagedProductDefinitionPackageContainedItemComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasItem()) { 
      for (Reference e : element.getItem()) 
          composeReference("item", e);
    }
    if (element.hasAmount()) {
      composeType("amount", element.getAmount());
    }  }

  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()) 
          composeParametersParameterComponent("parameter", e);
    }
  }

  protected void composeParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeParametersParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeParametersParameterComponentElements(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()) 
          composeParametersParameterComponent("part", e);
    }
  }

  protected void composePatient(String name, Patient element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composePatientCommunicationComponent("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()) 
          composePatientLinkComponent("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 composePatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePatientCommunicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePatientCommunicationComponentElements(Patient.PatientCommunicationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasLanguage()) {
      composeCodeableConcept("language", element.getLanguage());
    }
    if (element.hasPreferredElement()) {
      composeBoolean("preferred", element.getPreferredElement());
    }
  }

  protected void composePatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePatientLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePatientLinkComponentElements(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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    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.ClaimProcessingCodesEnumFactory());
    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 composePermission(String name, Permission element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePermissionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePermissionElements(Permission element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Permission.PermissionStatusEnumFactory());
    if (element.hasIntent()) {
      composeCodeableConcept("intent", element.getIntent());
    }
    if (element.hasAsserter()) {
      composeReference("asserter", element.getAsserter());
    }
    if (element.hasAssertionDate()) { 
      for (DateTimeType e : element.getAssertionDate()) 
          composeDateTime("assertionDate", e);
    }
    if (element.hasValidity()) {
      composePeriod("validity", element.getValidity());
    }
    if (element.hasPurpose()) { 
      for (CodeableConcept e : element.getPurpose()) 
          composeCodeableConcept("purpose", e);
    }
    if (element.hasDataScope()) { 
      for (Expression e : element.getDataScope()) 
          composeExpression("dataScope", e);
    }
    if (element.hasProcessingActivity()) { 
      for (Permission.PermissionProcessingActivityComponent e : element.getProcessingActivity()) 
          composePermissionProcessingActivityComponent("processingActivity", e);
    }
    if (element.hasJustification()) {
      composePermissionJustificationComponent("justification", element.getJustification());
    }
    if (element.hasUsageLimitations()) { 
      for (CodeableConcept e : element.getUsageLimitations()) 
          composeCodeableConcept("usageLimitations", e);
    }
  }

  protected void composePermissionProcessingActivityComponent(String name, Permission.PermissionProcessingActivityComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePermissionProcessingActivityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePermissionProcessingActivityComponentElements(Permission.PermissionProcessingActivityComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPartyReference()) { 
      for (Reference e : element.getPartyReference()) 
          composeReference("partyReference", e);
    }
    if (element.hasPartyCodeableConcept()) { 
      for (CodeableConcept e : element.getPartyCodeableConcept()) 
          composeCodeableConcept("partyCodeableConcept", e);
    }
    if (element.hasPurpose()) { 
      for (CodeableConcept e : element.getPurpose()) 
          composeCodeableConcept("purpose", e);
    }
  }

  protected void composePermissionJustificationComponent(String name, Permission.PermissionJustificationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePermissionJustificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePermissionJustificationComponentElements(Permission.PermissionJustificationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasEvidence()) { 
      for (Reference e : element.getEvidence()) 
          composeReference("evidence", e);
    }
    if (element.hasGrounds()) { 
      for (CodeableConcept e : element.getGrounds()) 
          composeCodeableConcept("grounds", e);
    }
  }

  protected void composePerson(String name, Person element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composePersonLinkComponent("link", e);
    }
  }

  protected void composePersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePersonLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePersonLinkComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionElements(PlanDefinition element) throws IOException {
    composeMetadataResourceElements(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()) 
          composePlanDefinitionGoalComponent("goal", e);
    }
    if (element.hasAction()) { 
      for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
          composePlanDefinitionActionComponent("action", e);
    }
  }

  protected void composePlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionGoalComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionGoalComponentElements(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()) 
          composePlanDefinitionGoalTargetComponent("target", e);
    }
  }

  protected void composePlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionGoalTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionGoalTargetComponentElements(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 composePlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionActionComponentElements(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 Enumerations.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()) 
          composePlanDefinitionActionConditionComponent("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()) 
          composePlanDefinitionActionRelatedActionComponent("relatedAction", e);
    }
    if (element.hasTiming()) {
      composeType("timing", element.getTiming());
    }    if (element.hasParticipant()) { 
      for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
          composePlanDefinitionActionParticipantComponent("participant", e);
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasGroupingBehaviorElement())
      composeEnumeration("groupingBehavior", element.getGroupingBehaviorElement(), new Enumerations.ActionGroupingBehaviorEnumFactory());
    if (element.hasSelectionBehaviorElement())
      composeEnumeration("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory());
    if (element.hasRequiredBehaviorElement())
      composeEnumeration("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory());
    if (element.hasPrecheckBehaviorElement())
      composeEnumeration("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory());
    if (element.hasCardinalityBehaviorElement())
      composeEnumeration("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory());
    if (element.hasDefinition()) {
      composeType("definition", element.getDefinition());
    }    if (element.hasTransformElement()) {
      composeCanonical("transform", element.getTransformElement());
    }
    if (element.hasDynamicValue()) { 
      for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
          composePlanDefinitionActionDynamicValueComponent("dynamicValue", e);
    }
    if (element.hasAction()) { 
      for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
          composePlanDefinitionActionComponent("action", e);
    }
  }

  protected void composePlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionActionConditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionActionConditionComponentElements(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory());
    if (element.hasExpression()) {
      composeExpression("expression", element.getExpression());
    }
  }

  protected void composePlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionActionRelatedActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionActionRelatedActionComponentElements(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasActionIdElement()) {
      composeId("actionId", element.getActionIdElement());
    }
    if (element.hasRelationshipElement())
      composeEnumeration("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory());
    if (element.hasOffset()) {
      composeType("offset", element.getOffset());
    }  }

  protected void composePlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionActionParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionActionParticipantComponentElements(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTypeElement())
      composeEnumeration("type", element.getTypeElement(), new Enumerations.ActionParticipantTypeEnumFactory());
    if (element.hasRole()) {
      composeCodeableConcept("role", element.getRole());
    }
  }

  protected void composePlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePlanDefinitionActionDynamicValueComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePlanDefinitionActionDynamicValueComponentElements(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) {
    composeResourceAttributes(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()) 
          composePractitionerQualificationComponent("qualification", e);
    }
    if (element.hasCommunication()) { 
      for (CodeableConcept e : element.getCommunication()) 
          composeCodeableConcept("communication", e);
    }
  }

  protected void composePractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerQualificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerQualificationComponentElements(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) {
    composeResourceAttributes(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()) 
          composePractitionerRoleAvailableTimeComponent("availableTime", e);
    }
    if (element.hasNotAvailable()) { 
      for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
          composePractitionerRoleNotAvailableComponent("notAvailable", e);
    }
    if (element.hasAvailabilityExceptionsElement()) {
      composeString("availabilityExceptions", element.getAvailabilityExceptionsElement());
    }
    if (element.hasEndpoint()) { 
      for (Reference e : element.getEndpoint()) 
          composeReference("endpoint", e);
    }
  }

  protected void composePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerRoleAvailableTimeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerRoleAvailableTimeComponentElements(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
    composeBackboneElementElements(element);
      if (element.hasDaysOfWeek()) 
        for (Enumeration<Enumerations.DaysOfWeek> e : element.getDaysOfWeek()) 
          composeEnumeration("daysOfWeek", e, new Enumerations.DaysOfWeekEnumFactory());
    if (element.hasAllDayElement()) {
      composeBoolean("allDay", element.getAllDayElement());
    }
    if (element.hasAvailableStartTimeElement()) {
      composeTime("availableStartTime", element.getAvailableStartTimeElement());
    }
    if (element.hasAvailableEndTimeElement()) {
      composeTime("availableEndTime", element.getAvailableEndTimeElement());
    }
  }

  protected void composePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composePractitionerRoleNotAvailableComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composePractitionerRoleNotAvailableComponentElements(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) {
    composeResourceAttributes(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 Enumerations.EventStatusEnumFactory());
    if (element.hasStatusReason()) {
      composeCodeableConcept("statusReason", element.getStatusReason());
    }
    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.hasOccurrence()) {
      composeType("occurrence", element.getOccurrence());
    }    if (element.hasRecordedElement()) {
      composeDateTime("recorded", element.getRecordedElement());
    }
    if (element.hasRecorder()) {
      composeReference("recorder", element.getRecorder());
    }
    if (element.hasReported()) {
      composeType("reported", element.getReported());
    }    if (element.hasPerformer()) { 
      for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
          composeProcedurePerformerComponent("performer", e);
    }
    if (element.hasLocation()) {
      composeReference("location", element.getLocation());
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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()) 
          composeProcedureFocalDeviceComponent("focalDevice", e);
    }
    if (element.hasUsed()) { 
      for (CodeableReference e : element.getUsed()) 
          composeCodeableReference("used", e);
    }
  }

  protected void composeProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcedurePerformerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcedurePerformerComponentElements(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 composeProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProcedureFocalDeviceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProcedureFocalDeviceComponentElements(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) {
    composeResourceAttributes(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()) 
          composeProvenanceAgentComponent("agent", e);
    }
    if (element.hasEntity()) { 
      for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
          composeProvenanceEntityComponent("entity", e);
    }
    if (element.hasSignature()) { 
      for (Signature e : element.getSignature()) 
          composeSignature("signature", e);
    }
  }

  protected void composeProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProvenanceAgentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProvenanceAgentComponentElements(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 composeProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeProvenanceEntityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeProvenanceEntityComponentElements(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()) 
          composeProvenanceAgentComponent("agent", e);
    }
  }

  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireElements(Questionnaire element) throws IOException {
    composeMetadataResourceElements(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()) 
          composeQuestionnaireItemComponent("item", e);
    }
  }

  protected void composeQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireItemComponentElements(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()) 
          composeQuestionnaireItemEnableWhenComponent("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()) 
          composeQuestionnaireItemAnswerOptionComponent("answerOption", e);
    }
    if (element.hasInitial()) { 
      for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
          composeQuestionnaireItemInitialComponent("initial", e);
    }
    if (element.hasItem()) { 
      for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
          composeQuestionnaireItemComponent("item", e);
    }
  }

  protected void composeQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireItemEnableWhenComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireItemEnableWhenComponentElements(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 composeQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireItemAnswerOptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireItemAnswerOptionComponentElements(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }    if (element.hasInitialSelectedElement()) {
      composeBoolean("initialSelected", element.getInitialSelectedElement());
    }
  }

  protected void composeQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireItemInitialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireItemInitialComponentElements(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) {
    composeResourceAttributes(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()) 
          composeQuestionnaireResponseItemComponent("item", e);
    }
  }

  protected void composeQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireResponseItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireResponseItemComponentElements(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()) 
          composeQuestionnaireResponseItemAnswerComponent("answer", e);
    }
    if (element.hasItem()) { 
      for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
          composeQuestionnaireResponseItemComponent("item", e);
    }
  }

  protected void composeQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeQuestionnaireResponseItemAnswerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeQuestionnaireResponseItemAnswerComponentElements(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }    if (element.hasItem()) { 
      for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
          composeQuestionnaireResponseItemComponent("item", e);
    }
  }

  protected void composeRegulatedAuthorization(String name, RegulatedAuthorization element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRegulatedAuthorizationElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRegulatedAuthorizationElements(RegulatedAuthorization 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.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasRegion()) { 
      for (CodeableConcept e : element.getRegion()) 
          composeCodeableConcept("region", e);
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasStatusDateElement()) {
      composeDateTime("statusDate", element.getStatusDateElement());
    }
    if (element.hasValidityPeriod()) {
      composePeriod("validityPeriod", element.getValidityPeriod());
    }
    if (element.hasIndication()) {
      composeType("indication", element.getIndication());
    }    if (element.hasIntendedUse()) {
      composeCodeableConcept("intendedUse", element.getIntendedUse());
    }
    if (element.hasBasis()) { 
      for (CodeableConcept e : element.getBasis()) 
          composeCodeableConcept("basis", e);
    }
    if (element.hasRelatedDate()) { 
      for (RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent e : element.getRelatedDate()) 
          composeRegulatedAuthorizationRelatedDateComponent("relatedDate", e);
    }
    if (element.hasJurisdictionalAuthorization()) { 
      for (Reference e : element.getJurisdictionalAuthorization()) 
          composeReference("jurisdictionalAuthorization", e);
    }
    if (element.hasHolder()) {
      composeReference("holder", element.getHolder());
    }
    if (element.hasRegulator()) {
      composeReference("regulator", element.getRegulator());
    }
    if (element.hasCase()) {
      composeRegulatedAuthorizationCaseComponent("case", element.getCase());
    }
  }

  protected void composeRegulatedAuthorizationRelatedDateComponent(String name, RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRegulatedAuthorizationRelatedDateComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRegulatedAuthorizationRelatedDateComponentElements(RegulatedAuthorization.RegulatedAuthorizationRelatedDateComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDate()) {
      composeType("date", element.getDate());
    }    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
  }

  protected void composeRegulatedAuthorizationCaseComponent(String name, RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRegulatedAuthorizationCaseComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRegulatedAuthorizationCaseComponentElements(RegulatedAuthorization.RegulatedAuthorizationCaseComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasDate()) {
      composeType("date", element.getDate());
    }    if (element.hasApplication()) { 
      for (RegulatedAuthorization.RegulatedAuthorizationCaseComponent e : element.getApplication()) 
          composeRegulatedAuthorizationCaseComponent("application", e);
    }
  }

  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeRelatedPersonCommunicationComponent("communication", e);
    }
  }

  protected void composeRelatedPersonCommunicationComponent(String name, RelatedPerson.RelatedPersonCommunicationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRelatedPersonCommunicationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRelatedPersonCommunicationComponentElements(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) {
    composeResourceAttributes(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 Enumerations.RequestStatusEnumFactory());
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory());
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new Enumerations.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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasAction()) { 
      for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
          composeRequestGroupActionComponent("action", e);
    }
  }

  protected void composeRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRequestGroupActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRequestGroupActionComponentElements(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 Enumerations.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()) 
          composeRequestGroupActionConditionComponent("condition", e);
    }
    if (element.hasRelatedAction()) { 
      for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
          composeRequestGroupActionRelatedActionComponent("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 Enumerations.ActionGroupingBehaviorEnumFactory());
    if (element.hasSelectionBehaviorElement())
      composeEnumeration("selectionBehavior", element.getSelectionBehaviorElement(), new Enumerations.ActionSelectionBehaviorEnumFactory());
    if (element.hasRequiredBehaviorElement())
      composeEnumeration("requiredBehavior", element.getRequiredBehaviorElement(), new Enumerations.ActionRequiredBehaviorEnumFactory());
    if (element.hasPrecheckBehaviorElement())
      composeEnumeration("precheckBehavior", element.getPrecheckBehaviorElement(), new Enumerations.ActionPrecheckBehaviorEnumFactory());
    if (element.hasCardinalityBehaviorElement())
      composeEnumeration("cardinalityBehavior", element.getCardinalityBehaviorElement(), new Enumerations.ActionCardinalityBehaviorEnumFactory());
    if (element.hasResource()) {
      composeReference("resource", element.getResource());
    }
    if (element.hasAction()) { 
      for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
          composeRequestGroupActionComponent("action", e);
    }
  }

  protected void composeRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRequestGroupActionConditionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRequestGroupActionConditionComponentElements(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new Enumerations.ActionConditionKindEnumFactory());
    if (element.hasExpression()) {
      composeExpression("expression", element.getExpression());
    }
  }

  protected void composeRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRequestGroupActionRelatedActionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRequestGroupActionRelatedActionComponentElements(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasActionIdElement()) {
      composeId("actionId", element.getActionIdElement());
    }
    if (element.hasRelationshipElement())
      composeEnumeration("relationship", element.getRelationshipElement(), new Enumerations.ActionRelationshipTypeEnumFactory());
    if (element.hasOffset()) {
      composeType("offset", element.getOffset());
    }  }

  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeResearchStudyArmComponent("arm", e);
    }
    if (element.hasObjective()) { 
      for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
          composeResearchStudyObjectiveComponent("objective", e);
    }
  }

  protected void composeResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchStudyArmComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchStudyArmComponentElements(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 composeResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchStudyObjectiveComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchStudyObjectiveComponentElements(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) {
    composeResourceAttributes(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.hasProgress()) { 
      for (ResearchSubject.ResearchSubjectProgressComponent e : element.getProgress()) 
          composeResearchSubjectProgressComponent("progress", e);
    }
    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 composeResearchSubjectProgressComponent(String name, ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeResearchSubjectProgressComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeResearchSubjectProgressComponentElements(ResearchSubject.ResearchSubjectProgressComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasState()) {
      composeCodeableConcept("state", element.getState());
    }
    if (element.hasMilestone()) {
      composeCodeableConcept("milestone", element.getMilestone());
    }
    if (element.hasReason()) {
      composeCodeableConcept("reason", element.getReason());
    }
    if (element.hasStartDateElement()) {
      composeDateTime("startDate", element.getStartDateElement());
    }
  }

  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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 Enumerations.ObservationStatusEnumFactory());
    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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasBasis()) { 
      for (Reference e : element.getBasis()) 
          composeReference("basis", e);
    }
    if (element.hasPrediction()) { 
      for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
          composeRiskAssessmentPredictionComponent("prediction", e);
    }
    if (element.hasMitigationElement()) {
      composeString("mitigation", element.getMitigationElement());
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
  }

  protected void composeRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeRiskAssessmentPredictionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeRiskAssessmentPredictionComponentElements(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 composeSchedule(String name, Schedule element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSearchParameterElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSearchParameterElements(SearchParameter element) throws IOException {
    composeCanonicalResourceElements(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<SearchParameter.SearchComparator> e : element.getComparator()) 
          composeEnumeration("comparator", e, new SearchParameter.SearchComparatorEnumFactory());
      if (element.hasModifier()) 
        for (Enumeration<SearchParameter.SearchModifierCode> 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()) 
          composeSearchParameterComponentComponent("component", e);
    }
  }

  protected void composeSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSearchParameterComponentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSearchParameterComponentComponentElements(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) {
    composeResourceAttributes(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 Enumerations.RequestStatusEnumFactory());
    if (element.hasIntentElement())
      composeEnumeration("intent", element.getIntentElement(), new Enumerations.RequestIntentEnumFactory());
    if (element.hasCategory()) { 
      for (CodeableConcept e : element.getCategory()) 
          composeCodeableConcept("category", e);
    }
    if (element.hasPriorityElement())
      composeEnumeration("priority", element.getPriorityElement(), new Enumerations.RequestPriorityEnumFactory());
    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.hasLocation()) { 
      for (CodeableReference e : element.getLocation()) 
          composeCodeableReference("location", e);
    }
    if (element.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", 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) {
    composeResourceAttributes(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) {
    composeResourceAttributes(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()) {
      composeSpecimenCollectionComponent("collection", element.getCollection());
    }
    if (element.hasProcessing()) { 
      for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
          composeSpecimenProcessingComponent("processing", e);
    }
    if (element.hasContainer()) { 
      for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
          composeSpecimenContainerComponent("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 composeSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenCollectionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenCollectionComponentElements(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 composeSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenProcessingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenProcessingComponentElements(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 composeSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenContainerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenContainerComponentElements(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) {
    composeResourceAttributes(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.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
    if (element.hasTitleElement()) {
      composeString("title", element.getTitleElement());
    }
    if (element.hasDerivedFromCanonical()) { 
      for (CanonicalType e : element.getDerivedFromCanonical()) 
          composeCanonical("derivedFromCanonical", e);
    }
    if (element.hasDerivedFromUri()) { 
      for (UriType e : element.getDerivedFromUri()) 
          composeUri("derivedFromUri", e);
    }
    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.hasPublisher()) {
      composeReference("publisher", element.getPublisher());
    }
    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.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()) 
          composeSpecimenDefinitionTypeTestedComponent("typeTested", e);
    }
  }

  protected void composeSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionTypeTestedComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionTypeTestedComponentElements(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()) {
      composeSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
    }
    if (element.hasRequirementElement()) {
      composeString("requirement", element.getRequirementElement());
    }
    if (element.hasRetentionTime()) {
      composeDuration("retentionTime", element.getRetentionTime());
    }
    if (element.hasSingleUseElement()) {
      composeBoolean("singleUse", element.getSingleUseElement());
    }
    if (element.hasRejectionCriterion()) { 
      for (CodeableConcept e : element.getRejectionCriterion()) 
          composeCodeableConcept("rejectionCriterion", e);
    }
    if (element.hasHandling()) { 
      for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
          composeSpecimenDefinitionTypeTestedHandlingComponent("handling", e);
    }
    if (element.hasTestingDestination()) { 
      for (CodeableConcept e : element.getTestingDestination()) 
          composeCodeableConcept("testingDestination", e);
    }
  }

  protected void composeSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionTypeTestedContainerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionTypeTestedContainerComponentElements(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()) 
          composeSpecimenDefinitionTypeTestedContainerAdditiveComponent("additive", e);
    }
    if (element.hasPreparationElement()) {
      composeString("preparation", element.getPreparationElement());
    }
  }

  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionTypeTestedContainerAdditiveComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionTypeTestedContainerAdditiveComponentElements(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAdditive()) {
      composeType("additive", element.getAdditive());
    }  }

  protected void composeSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSpecimenDefinitionTypeTestedHandlingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSpecimenDefinitionTypeTestedHandlingComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionElements(StructureDefinition element) throws IOException {
    composeCanonicalResourceElements(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()) 
          composeStructureDefinitionMappingComponent("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()) 
          composeStructureDefinitionContextComponent("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()) {
      composeStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
    }
    if (element.hasDifferential()) {
      composeStructureDefinitionDifferentialComponent("differential", element.getDifferential());
    }
  }

  protected void composeStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionMappingComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionMappingComponentElements(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 composeStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionContextComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionContextComponentElements(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 composeStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionSnapshotComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionSnapshotComponentElements(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasElement()) { 
      for (ElementDefinition e : element.getElement()) 
          composeElementDefinition("element", e);
    }
  }

  protected void composeStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureDefinitionDifferentialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureDefinitionDifferentialComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapElements(StructureMap element) throws IOException {
    composeCanonicalResourceElements(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()) 
          composeStructureMapStructureComponent("structure", e);
    }
    if (element.hasImport()) { 
      for (CanonicalType e : element.getImport()) 
          composeCanonical("import", e);
    }
    if (element.hasGroup()) { 
      for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
          composeStructureMapGroupComponent("group", e);
    }
  }

  protected void composeStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapStructureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapStructureComponentElements(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 composeStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapGroupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapGroupComponentElements(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()) 
          composeStructureMapGroupInputComponent("input", e);
    }
    if (element.hasRule()) { 
      for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
          composeStructureMapGroupRuleComponent("rule", e);
    }
  }

  protected void composeStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapGroupInputComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapGroupInputComponentElements(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 composeStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapGroupRuleComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapGroupRuleComponentElements(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeId("name", element.getNameElement());
    }
    if (element.hasSource()) { 
      for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
          composeStructureMapGroupRuleSourceComponent("source", e);
    }
    if (element.hasTarget()) { 
      for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
          composeStructureMapGroupRuleTargetComponent("target", e);
    }
    if (element.hasRule()) { 
      for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
          composeStructureMapGroupRuleComponent("rule", e);
    }
    if (element.hasDependent()) { 
      for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
          composeStructureMapGroupRuleDependentComponent("dependent", e);
    }
    if (element.hasDocumentationElement()) {
      composeString("documentation", element.getDocumentationElement());
    }
  }

  protected void composeStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapGroupRuleSourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapGroupRuleSourceComponentElements(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 composeStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapGroupRuleTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapGroupRuleTargetComponentElements(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<StructureMap.StructureMapTargetListMode> 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()) 
          composeStructureMapGroupRuleTargetParameterComponent("parameter", e);
    }
  }

  protected void composeStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapGroupRuleTargetParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapGroupRuleTargetParameterComponentElements(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeStructureMapGroupRuleDependentComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeStructureMapGroupRuleDependentComponentElements(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) {
    composeResourceAttributes(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.hasIdentifier()) { 
      for (Identifier e : element.getIdentifier()) 
          composeIdentifier("identifier", e);
    }
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.SubscriptionStateEnumFactory());
    if (element.hasTopic()) {
      composeReference("topic", element.getTopic());
    }
    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.hasFilterBy()) { 
      for (Subscription.SubscriptionFilterByComponent e : element.getFilterBy()) 
          composeSubscriptionFilterByComponent("filterBy", e);
    }
    if (element.hasError()) { 
      for (CodeableConcept e : element.getError()) 
          composeCodeableConcept("error", e);
    }
    if (element.hasChannelType()) {
      composeCoding("channelType", element.getChannelType());
    }
    if (element.hasEndpointElement()) {
      composeUrl("endpoint", element.getEndpointElement());
    }
    if (element.hasHeader()) { 
      for (StringType e : element.getHeader()) 
          composeString("header", e);
    }
    if (element.hasHeartbeatPeriodElement()) {
      composeUnsignedInt("heartbeatPeriod", element.getHeartbeatPeriodElement());
    }
    if (element.hasTimeoutElement()) {
      composeUnsignedInt("timeout", element.getTimeoutElement());
    }
    if (element.hasContentTypeElement()) {
      composeCode("contentType", element.getContentTypeElement());
    }
    if (element.hasContentElement())
      composeEnumeration("content", element.getContentElement(), new Subscription.SubscriptionPayloadContentEnumFactory());
  }

  protected void composeSubscriptionFilterByComponent(String name, Subscription.SubscriptionFilterByComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionFilterByComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionFilterByComponentElements(Subscription.SubscriptionFilterByComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSearchParamNameElement()) {
      composeString("searchParamName", element.getSearchParamNameElement());
    }
    if (element.hasSearchModifierElement())
      composeEnumeration("searchModifier", element.getSearchModifierElement(), new Enumerations.SubscriptionSearchModifierEnumFactory());
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
  }

  protected void composeSubscriptionStatus(String name, SubscriptionStatus element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionStatusElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionStatusElements(SubscriptionStatus element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasNotificationTypeElement())
      composeEnumeration("notificationType", element.getNotificationTypeElement(), new SubscriptionStatus.SubscriptionNotificationTypeEnumFactory());
    if (element.hasEventsSinceSubscriptionStartElement()) {
      composeInteger64("eventsSinceSubscriptionStart", element.getEventsSinceSubscriptionStartElement());
    }
    if (element.hasEventsInNotificationElement()) {
      composeInteger("eventsInNotification", element.getEventsInNotificationElement());
    }
    if (element.hasSubscription()) {
      composeReference("subscription", element.getSubscription());
    }
    if (element.hasStatusElement())
      composeEnumeration("status", element.getStatusElement(), new Enumerations.SubscriptionStateEnumFactory());
    if (element.hasTopic()) {
      composeReference("topic", element.getTopic());
    }
  }

  protected void composeSubscriptionTopic(String name, SubscriptionTopic element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionTopicElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionTopicElements(SubscriptionTopic 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.hasDerivedFromCanonical()) { 
      for (CanonicalType e : element.getDerivedFromCanonical()) 
          composeCanonical("derivedFromCanonical", e);
    }
    if (element.hasDerivedFromUri()) { 
      for (UriType e : element.getDerivedFromUri()) 
          composeUri("derivedFromUri", 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.hasPublisher()) {
      composeReference("publisher", element.getPublisher());
    }
    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.hasResourceTrigger()) {
      composeSubscriptionTopicResourceTriggerComponent("resourceTrigger", element.getResourceTrigger());
    }
    if (element.hasCanFilterBy()) { 
      for (SubscriptionTopic.SubscriptionTopicCanFilterByComponent e : element.getCanFilterBy()) 
          composeSubscriptionTopicCanFilterByComponent("canFilterBy", e);
    }
  }

  protected void composeSubscriptionTopicResourceTriggerComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionTopicResourceTriggerComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionTopicResourceTriggerComponentElements(SubscriptionTopic.SubscriptionTopicResourceTriggerComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasResourceType()) { 
      for (CodeType e : element.getResourceType()) 
          composeCode("resourceType", e);
    }
      if (element.hasMethodCriteria()) 
        for (Enumeration<SubscriptionTopic.InteractionTrigger> e : element.getMethodCriteria()) 
          composeEnumeration("methodCriteria", e, new SubscriptionTopic.InteractionTriggerEnumFactory());
    if (element.hasQueryCriteria()) {
      composeSubscriptionTopicResourceTriggerQueryCriteriaComponent("queryCriteria", element.getQueryCriteria());
    }
    if (element.hasFhirPathCriteria()) { 
      for (StringType e : element.getFhirPathCriteria()) 
          composeString("fhirPathCriteria", e);
    }
  }

  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponent(String name, SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionTopicResourceTriggerQueryCriteriaComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionTopicResourceTriggerQueryCriteriaComponentElements(SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPreviousElement()) {
      composeString("previous", element.getPreviousElement());
    }
    if (element.hasCurrentElement()) {
      composeString("current", element.getCurrentElement());
    }
    if (element.hasRequireBothElement()) {
      composeBoolean("requireBoth", element.getRequireBothElement());
    }
  }

  protected void composeSubscriptionTopicCanFilterByComponent(String name, SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubscriptionTopicCanFilterByComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubscriptionTopicCanFilterByComponentElements(SubscriptionTopic.SubscriptionTopicCanFilterByComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSearchParamNameElement()) {
      composeString("searchParamName", element.getSearchParamNameElement());
    }
      if (element.hasSearchModifier()) 
        for (Enumeration<Enumerations.SubscriptionSearchModifier> e : element.getSearchModifier()) 
          composeEnumeration("searchModifier", e, new Enumerations.SubscriptionSearchModifierEnumFactory());
    if (element.hasDocumentationElement()) {
      composeMarkdown("documentation", element.getDocumentationElement());
    }
  }

  protected void composeSubstance(String name, Substance element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeSubstanceInstanceComponent("instance", e);
    }
    if (element.hasIngredient()) { 
      for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
          composeSubstanceIngredientComponent("ingredient", e);
    }
  }

  protected void composeSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceInstanceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceInstanceComponentElements(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 composeSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceIngredientComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceIngredientComponentElements(Substance.SubstanceIngredientComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasQuantity()) {
      composeRatio("quantity", element.getQuantity());
    }
    if (element.hasSubstance()) {
      composeType("substance", element.getSubstance());
    }  }

  protected void composeSubstanceDefinition(String name, SubstanceDefinition element) throws IOException {
    if (element != null) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionElements(SubstanceDefinition element) throws IOException {
    composeDomainResourceElements(element);
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
    if (element.hasStatus()) {
      composeCodeableConcept("status", element.getStatus());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasDomain()) {
      composeCodeableConcept("domain", element.getDomain());
    }
    if (element.hasDescriptionElement()) {
      composeMarkdown("description", element.getDescriptionElement());
    }
    if (element.hasSource()) { 
      for (Reference e : element.getSource()) 
          composeReference("source", e);
    }
    if (element.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasManufacturer()) { 
      for (Reference e : element.getManufacturer()) 
          composeReference("manufacturer", e);
    }
    if (element.hasSupplier()) { 
      for (Reference e : element.getSupplier()) 
          composeReference("supplier", e);
    }
    if (element.hasMoiety()) { 
      for (SubstanceDefinition.SubstanceDefinitionMoietyComponent e : element.getMoiety()) 
          composeSubstanceDefinitionMoietyComponent("moiety", e);
    }
    if (element.hasProperty()) { 
      for (SubstanceDefinition.SubstanceDefinitionPropertyComponent e : element.getProperty()) 
          composeSubstanceDefinitionPropertyComponent("property", e);
    }
    if (element.hasReferenceInformation()) {
      composeReference("referenceInformation", element.getReferenceInformation());
    }
    if (element.hasStructure()) {
      composeSubstanceDefinitionStructureComponent("structure", element.getStructure());
    }
    if (element.hasCode()) { 
      for (SubstanceDefinition.SubstanceDefinitionCodeComponent e : element.getCode()) 
          composeSubstanceDefinitionCodeComponent("code", e);
    }
    if (element.hasName()) { 
      for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getName()) 
          composeSubstanceDefinitionNameComponent("name", e);
    }
    if (element.hasMolecularWeight()) { 
      for (SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
          composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent("molecularWeight", e);
    }
    if (element.hasRelationship()) { 
      for (SubstanceDefinition.SubstanceDefinitionRelationshipComponent e : element.getRelationship()) 
          composeSubstanceDefinitionRelationshipComponent("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 composeSubstanceDefinitionMoietyComponent(String name, SubstanceDefinition.SubstanceDefinitionMoietyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionMoietyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionMoietyComponentElements(SubstanceDefinition.SubstanceDefinitionMoietyComponent 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());
    }    if (element.hasAmountType()) {
      composeCodeableConcept("amountType", element.getAmountType());
    }
  }

  protected void composeSubstanceDefinitionPropertyComponent(String name, SubstanceDefinition.SubstanceDefinitionPropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionPropertyComponentElements(SubstanceDefinition.SubstanceDefinitionPropertyComponent 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());
    }    if (element.hasReferenceRange()) {
      composeRange("referenceRange", element.getReferenceRange());
    }
    if (element.hasSource()) { 
      for (Reference e : element.getSource()) 
          composeReference("source", e);
    }
  }

  protected void composeSubstanceDefinitionStructureComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionStructureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionStructureComponentElements(SubstanceDefinition.SubstanceDefinitionStructureComponent 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 (SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent e : element.getIsotope()) 
          composeSubstanceDefinitionStructureIsotopeComponent("isotope", e);
    }
    if (element.hasMolecularWeight()) {
      composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
    }
    if (element.hasTechnique()) { 
      for (CodeableConcept e : element.getTechnique()) 
          composeCodeableConcept("technique", e);
    }
    if (element.hasSourceDocument()) { 
      for (Reference e : element.getSourceDocument()) 
          composeReference("sourceDocument", e);
    }
    if (element.hasRepresentation()) { 
      for (SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent e : element.getRepresentation()) 
          composeSubstanceDefinitionStructureRepresentationComponent("representation", e);
    }
  }

  protected void composeSubstanceDefinitionStructureIsotopeComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionStructureIsotopeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionStructureIsotopeComponentElements(SubstanceDefinition.SubstanceDefinitionStructureIsotopeComponent 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()) {
      composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
    }
  }

  protected void composeSubstanceDefinitionStructureIsotopeMolecularWeightComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionStructureIsotopeMolecularWeightComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionStructureIsotopeMolecularWeightComponentElements(SubstanceDefinition.SubstanceDefinitionStructureIsotopeMolecularWeightComponent 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 composeSubstanceDefinitionStructureRepresentationComponent(String name, SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionStructureRepresentationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionStructureRepresentationComponentElements(SubstanceDefinition.SubstanceDefinitionStructureRepresentationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRepresentationElement()) {
      composeString("representation", element.getRepresentationElement());
    }
    if (element.hasFormat()) {
      composeCodeableConcept("format", element.getFormat());
    }
    if (element.hasAttachment()) {
      composeAttachment("attachment", element.getAttachment());
    }
  }

  protected void composeSubstanceDefinitionCodeComponent(String name, SubstanceDefinition.SubstanceDefinitionCodeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionCodeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionCodeComponentElements(SubstanceDefinition.SubstanceDefinitionCodeComponent 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.hasNote()) { 
      for (Annotation e : element.getNote()) 
          composeAnnotation("note", e);
    }
    if (element.hasSource()) { 
      for (Reference e : element.getSource()) 
          composeReference("source", e);
    }
  }

  protected void composeSubstanceDefinitionNameComponent(String name, SubstanceDefinition.SubstanceDefinitionNameComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionNameComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionNameComponentElements(SubstanceDefinition.SubstanceDefinitionNameComponent 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 (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getSynonym()) 
          composeSubstanceDefinitionNameComponent("synonym", e);
    }
    if (element.hasTranslation()) { 
      for (SubstanceDefinition.SubstanceDefinitionNameComponent e : element.getTranslation()) 
          composeSubstanceDefinitionNameComponent("translation", e);
    }
    if (element.hasOfficial()) { 
      for (SubstanceDefinition.SubstanceDefinitionNameOfficialComponent e : element.getOfficial()) 
          composeSubstanceDefinitionNameOfficialComponent("official", e);
    }
    if (element.hasSource()) { 
      for (Reference e : element.getSource()) 
          composeReference("source", e);
    }
  }

  protected void composeSubstanceDefinitionNameOfficialComponent(String name, SubstanceDefinition.SubstanceDefinitionNameOfficialComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionNameOfficialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionNameOfficialComponentElements(SubstanceDefinition.SubstanceDefinitionNameOfficialComponent 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 composeSubstanceDefinitionRelationshipComponent(String name, SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceDefinitionRelationshipComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceDefinitionRelationshipComponentElements(SubstanceDefinition.SubstanceDefinitionRelationshipComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasSubstanceDefinition()) {
      composeType("substanceDefinition", element.getSubstanceDefinition());
    }    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasIsDefiningElement()) {
      composeBoolean("isDefining", element.getIsDefiningElement());
    }
    if (element.hasAmount()) {
      composeType("amount", element.getAmount());
    }    if (element.hasAmountRatioHighLimit()) {
      composeRatio("amountRatioHighLimit", element.getAmountRatioHighLimit());
    }
    if (element.hasAmountType()) {
      composeCodeableConcept("amountType", element.getAmountType());
    }
    if (element.hasSource()) { 
      for (Reference e : element.getSource()) 
          composeReference("source", e);
    }
  }

  protected void composeSubstanceNucleicAcid(String name, SubstanceNucleicAcid element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeSubstanceNucleicAcidSubunitComponent("subunit", e);
    }
  }

  protected void composeSubstanceNucleicAcidSubunitComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceNucleicAcidSubunitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceNucleicAcidSubunitComponentElements(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()) 
          composeSubstanceNucleicAcidSubunitLinkageComponent("linkage", e);
    }
    if (element.hasSugar()) { 
      for (SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent e : element.getSugar()) 
          composeSubstanceNucleicAcidSubunitSugarComponent("sugar", e);
    }
  }

  protected void composeSubstanceNucleicAcidSubunitLinkageComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitLinkageComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceNucleicAcidSubunitLinkageComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceNucleicAcidSubunitLinkageComponentElements(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 composeSubstanceNucleicAcidSubunitSugarComponent(String name, SubstanceNucleicAcid.SubstanceNucleicAcidSubunitSugarComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceNucleicAcidSubunitSugarComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceNucleicAcidSubunitSugarComponentElements(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) {
    composeResourceAttributes(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.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifier());
    }
    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.hasModificationElement()) {
      composeString("modification", element.getModificationElement());
    }
    if (element.hasMonomerSet()) { 
      for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
          composeSubstancePolymerMonomerSetComponent("monomerSet", e);
    }
    if (element.hasRepeat()) { 
      for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
          composeSubstancePolymerRepeatComponent("repeat", e);
    }
  }

  protected void composeSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerMonomerSetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerMonomerSetComponentElements(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasRatioType()) {
      composeCodeableConcept("ratioType", element.getRatioType());
    }
    if (element.hasStartingMaterial()) { 
      for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
          composeSubstancePolymerMonomerSetStartingMaterialComponent("startingMaterial", e);
    }
  }

  protected void composeSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerMonomerSetStartingMaterialComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerMonomerSetStartingMaterialComponentElements(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCode()) {
      composeCodeableConcept("code", element.getCode());
    }
    if (element.hasCategory()) {
      composeCodeableConcept("category", element.getCategory());
    }
    if (element.hasIsDefiningElement()) {
      composeBoolean("isDefining", element.getIsDefiningElement());
    }
    if (element.hasAmount()) {
      composeSubstanceAmount("amount", element.getAmount());
    }
  }

  protected void composeSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerRepeatComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerRepeatComponentElements(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()) 
          composeSubstancePolymerRepeatRepeatUnitComponent("repeatUnit", e);
    }
  }

  protected void composeSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerRepeatRepeatUnitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerRepeatRepeatUnitComponentElements(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasUnitElement()) {
      composeString("unit", element.getUnitElement());
    }
    if (element.hasOrientation()) {
      composeCodeableConcept("orientation", element.getOrientation());
    }
    if (element.hasAmount()) {
      composeSubstanceAmount("amount", element.getAmount());
    }
    if (element.hasDegreeOfPolymerisation()) { 
      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
          composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent("degreeOfPolymerisation", e);
    }
    if (element.hasStructuralRepresentation()) { 
      for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
          composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent("structuralRepresentation", e);
    }
  }

  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentElements(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDegree()) {
      composeCodeableConcept("degree", element.getDegree());
    }
    if (element.hasAmount()) {
      composeSubstanceAmount("amount", element.getAmount());
    }
  }

  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentElements(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasType()) {
      composeCodeableConcept("type", element.getType());
    }
    if (element.hasRepresentationElement()) {
      composeString("representation", element.getRepresentationElement());
    }
    if (element.hasFormat()) {
      composeCodeableConcept("format", element.getFormat());
    }
    if (element.hasAttachment()) {
      composeAttachment("attachment", element.getAttachment());
    }
  }

  protected void composeSubstanceProtein(String name, SubstanceProtein element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeSubstanceProteinSubunitComponent("subunit", e);
    }
  }

  protected void composeSubstanceProteinSubunitComponent(String name, SubstanceProtein.SubstanceProteinSubunitComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceProteinSubunitComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceProteinSubunitComponentElements(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) {
    composeResourceAttributes(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()) 
          composeSubstanceReferenceInformationGeneComponent("gene", e);
    }
    if (element.hasGeneElement()) { 
      for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
          composeSubstanceReferenceInformationGeneElementComponent("geneElement", e);
    }
    if (element.hasClassification()) { 
      for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
          composeSubstanceReferenceInformationClassificationComponent("classification", e);
    }
    if (element.hasTarget()) { 
      for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
          composeSubstanceReferenceInformationTargetComponent("target", e);
    }
  }

  protected void composeSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationGeneComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationGeneComponentElements(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 composeSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationGeneElementComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationGeneElementComponentElements(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 composeSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationClassificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationClassificationComponentElements(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 composeSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceReferenceInformationTargetComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceReferenceInformationTargetComponentElements(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) {
    composeResourceAttributes(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()) 
          composeSubstanceSourceMaterialFractionDescriptionComponent("fractionDescription", e);
    }
    if (element.hasOrganism()) {
      composeSubstanceSourceMaterialOrganismComponent("organism", element.getOrganism());
    }
    if (element.hasPartDescription()) { 
      for (SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent e : element.getPartDescription()) 
          composeSubstanceSourceMaterialPartDescriptionComponent("partDescription", e);
    }
  }

  protected void composeSubstanceSourceMaterialFractionDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialFractionDescriptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialFractionDescriptionComponentElements(SubstanceSourceMaterial.SubstanceSourceMaterialFractionDescriptionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasFractionElement()) {
      composeString("fraction", element.getFractionElement());
    }
    if (element.hasMaterialType()) {
      composeCodeableConcept("materialType", element.getMaterialType());
    }
  }

  protected void composeSubstanceSourceMaterialOrganismComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialOrganismComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialOrganismComponentElements(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()) 
          composeSubstanceSourceMaterialOrganismAuthorComponent("author", e);
    }
    if (element.hasHybrid()) {
      composeSubstanceSourceMaterialOrganismHybridComponent("hybrid", element.getHybrid());
    }
    if (element.hasOrganismGeneral()) {
      composeSubstanceSourceMaterialOrganismOrganismGeneralComponent("organismGeneral", element.getOrganismGeneral());
    }
  }

  protected void composeSubstanceSourceMaterialOrganismAuthorComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialOrganismAuthorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialOrganismAuthorComponentElements(SubstanceSourceMaterial.SubstanceSourceMaterialOrganismAuthorComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasAuthorType()) {
      composeCodeableConcept("authorType", element.getAuthorType());
    }
    if (element.hasAuthorDescriptionElement()) {
      composeString("authorDescription", element.getAuthorDescriptionElement());
    }
  }

  protected void composeSubstanceSourceMaterialOrganismHybridComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismHybridComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialOrganismHybridComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialOrganismHybridComponentElements(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 composeSubstanceSourceMaterialOrganismOrganismGeneralComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialOrganismOrganismGeneralComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialOrganismOrganismGeneralComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialOrganismOrganismGeneralComponentElements(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 composeSubstanceSourceMaterialPartDescriptionComponent(String name, SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSubstanceSourceMaterialPartDescriptionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSubstanceSourceMaterialPartDescriptionComponentElements(SubstanceSourceMaterial.SubstanceSourceMaterialPartDescriptionComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasPart()) {
      composeCodeableConcept("part", element.getPart());
    }
    if (element.hasPartLocation()) {
      composeCodeableConcept("partLocation", element.getPartLocation());
    }
  }

  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) {
      composeSupplyDeliverySuppliedItemComponent("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 composeSupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyDeliverySuppliedItemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyDeliverySuppliedItemComponentElements(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) {
    composeResourceAttributes(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 Enumerations.RequestPriorityEnumFactory());
    if (element.hasItem()) {
      composeCodeableReference("item", element.getItem());
    }
    if (element.hasQuantity()) {
      composeQuantity("quantity", element.getQuantity());
    }
    if (element.hasParameter()) { 
      for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
          composeSupplyRequestParameterComponent("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.hasReason()) { 
      for (CodeableReference e : element.getReason()) 
          composeCodeableReference("reason", e);
    }
    if (element.hasDeliverFrom()) {
      composeReference("deliverFrom", element.getDeliverFrom());
    }
    if (element.hasDeliverTo()) {
      composeReference("deliverTo", element.getDeliverTo());
    }
  }

  protected void composeSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeSupplyRequestParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeSupplyRequestParameterComponentElements(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) {
    composeResourceAttributes(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 Enumerations.RequestPriorityEnumFactory());
    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()) {
      composeTaskRestrictionComponent("restriction", element.getRestriction());
    }
    if (element.hasInput()) { 
      for (Task.ParameterComponent e : element.getInput()) 
          composeTaskParameterComponent("input", e);
    }
    if (element.hasOutput()) { 
      for (Task.TaskOutputComponent e : element.getOutput()) 
          composeTaskOutputComponent("output", e);
    }
  }

  protected void composeTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTaskRestrictionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTaskRestrictionComponentElements(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 composeTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTaskOutputComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTaskOutputComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesElements(TerminologyCapabilities element) throws IOException {
    composeCanonicalResourceElements(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.hasKindElement())
      composeEnumeration("kind", element.getKindElement(), new Enumerations.CapabilityStatementKindEnumFactory());
    if (element.hasSoftware()) {
      composeTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
    }
    if (element.hasImplementation()) {
      composeTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
    }
    if (element.hasLockedDateElement()) {
      composeBoolean("lockedDate", element.getLockedDateElement());
    }
    if (element.hasCodeSystem()) { 
      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
          composeTerminologyCapabilitiesCodeSystemComponent("codeSystem", e);
    }
    if (element.hasExpansion()) {
      composeTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
    }
    if (element.hasCodeSearchElement())
      composeEnumeration("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory());
    if (element.hasValidateCode()) {
      composeTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
    }
    if (element.hasTranslation()) {
      composeTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
    }
    if (element.hasClosure()) {
      composeTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
    }
  }

  protected void composeTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesSoftwareComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesSoftwareComponentElements(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasVersionElement()) {
      composeString("version", element.getVersionElement());
    }
  }

  protected void composeTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesImplementationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesImplementationComponentElements(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
    if (element.hasUrlElement()) {
      composeUrl("url", element.getUrlElement());
    }
  }

  protected void composeTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesCodeSystemComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesCodeSystemComponentElements(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasUriElement()) {
      composeCanonical("uri", element.getUriElement());
    }
    if (element.hasVersion()) { 
      for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
          composeTerminologyCapabilitiesCodeSystemVersionComponent("version", e);
    }
    if (element.hasSubsumptionElement()) {
      composeBoolean("subsumption", element.getSubsumptionElement());
    }
  }

  protected void composeTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesCodeSystemVersionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesCodeSystemVersionComponentElements(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()) 
          composeTerminologyCapabilitiesCodeSystemVersionFilterComponent("filter", e);
    }
    if (element.hasProperty()) { 
      for (CodeType e : element.getProperty()) 
          composeCode("property", e);
    }
  }

  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesCodeSystemVersionFilterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesCodeSystemVersionFilterComponentElements(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 composeTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesExpansionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesExpansionComponentElements(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()) 
          composeTerminologyCapabilitiesExpansionParameterComponent("parameter", e);
    }
    if (element.hasTextFilterElement()) {
      composeMarkdown("textFilter", element.getTextFilterElement());
    }
  }

  protected void composeTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesExpansionParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesExpansionParameterComponentElements(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeCode("name", element.getNameElement());
    }
    if (element.hasDocumentationElement()) {
      composeString("documentation", element.getDocumentationElement());
    }
  }

  protected void composeTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesValidateCodeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesValidateCodeComponentElements(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasTranslationsElement()) {
      composeBoolean("translations", element.getTranslationsElement());
    }
  }

  protected void composeTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesTranslationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesTranslationComponentElements(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNeedsMapElement()) {
      composeBoolean("needsMap", element.getNeedsMapElement());
    }
  }

  protected void composeTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTerminologyCapabilitiesClosureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTerminologyCapabilitiesClosureComponentElements(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) {
    composeResourceAttributes(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()) 
          composeTestReportParticipantComponent("participant", e);
    }
    if (element.hasSetup()) {
      composeTestReportSetupComponent("setup", element.getSetup());
    }
    if (element.hasTest()) { 
      for (TestReport.TestReportTestComponent e : element.getTest()) 
          composeTestReportTestComponent("test", e);
    }
    if (element.hasTeardown()) {
      composeTestReportTeardownComponent("teardown", element.getTeardown());
    }
  }

  protected void composeTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportParticipantComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportParticipantComponentElements(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 composeTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportSetupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportSetupComponentElements(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 composeTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTestComponentElements(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 composeTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestReportTeardownComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestReportTeardownComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptElements(TestScript element) throws IOException {
    composeCanonicalResourceElements(element);
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasIdentifier()) {
      composeIdentifier("identifier", element.getIdentifierFirstRep());
    }
    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()) 
          composeTestScriptOriginComponent("origin", e);
    }
    if (element.hasDestination()) { 
      for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
          composeTestScriptDestinationComponent("destination", e);
    }
    if (element.hasMetadata()) {
      composeTestScriptMetadataComponent("metadata", element.getMetadata());
    }
    if (element.hasFixture()) { 
      for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
          composeTestScriptFixtureComponent("fixture", e);
    }
    if (element.hasProfile()) { 
      for (Reference e : element.getProfile()) 
          composeReference("profile", e);
    }
    if (element.hasVariable()) { 
      for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
          composeTestScriptVariableComponent("variable", e);
    }
    if (element.hasSetup()) {
      composeTestScriptSetupComponent("setup", element.getSetup());
    }
    if (element.hasTest()) { 
      for (TestScript.TestScriptTestComponent e : element.getTest()) 
          composeTestScriptTestComponent("test", e);
    }
    if (element.hasTeardown()) {
      composeTestScriptTeardownComponent("teardown", element.getTeardown());
    }
  }

  protected void composeTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptOriginComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptOriginComponentElements(TestScript.TestScriptOriginComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIndexElement()) {
      composeInteger("index", element.getIndexElement());
    }
    if (element.hasProfile()) {
      composeCoding("profile", element.getProfile());
    }
  }

  protected void composeTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptDestinationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptDestinationComponentElements(TestScript.TestScriptDestinationComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasIndexElement()) {
      composeInteger("index", element.getIndexElement());
    }
    if (element.hasProfile()) {
      composeCoding("profile", element.getProfile());
    }
  }

  protected void composeTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptMetadataComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptMetadataComponentElements(TestScript.TestScriptMetadataComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasLink()) { 
      for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
          composeTestScriptMetadataLinkComponent("link", e);
    }
    if (element.hasCapability()) { 
      for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
          composeTestScriptMetadataCapabilityComponent("capability", e);
    }
  }

  protected void composeTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptMetadataLinkComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptMetadataLinkComponentElements(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasUrlElement()) {
      composeUri("url", element.getUrlElement());
    }
    if (element.hasDescriptionElement()) {
      composeString("description", element.getDescriptionElement());
    }
  }

  protected void composeTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptMetadataCapabilityComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptMetadataCapabilityComponentElements(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 composeTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptFixtureComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptFixtureComponentElements(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 composeTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptVariableComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptVariableComponentElements(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 composeTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptSetupComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptSetupComponentElements(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())
      composeEnumeration("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory());
    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())
      composeEnumeration("resource", element.getResourceElement(), new TestScript.FHIRDefinedTypeEnumFactory());
    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 composeTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTestComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTestComponentElements(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 composeTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeTestScriptTeardownComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeTestScriptTeardownComponentElements(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) {
    composeResourceAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetElements(ValueSet element) throws IOException {
    composeCanonicalResourceElements(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()) {
      composeValueSetComposeComponent("compose", element.getCompose());
    }
    if (element.hasExpansion()) {
      composeValueSetExpansionComponent("expansion", element.getExpansion());
    }
  }

  protected void composeValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetComposeComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetComposeComponentElements(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);
    }
    if (element.hasProperty()) { 
      for (StringType e : element.getProperty()) 
          composeString("property", 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 Enumerations.FilterOperatorEnumFactory());
    if (element.hasValueElement()) {
      composeString("value", element.getValueElement());
    }
  }

  protected void composeValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetExpansionComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetExpansionComponentElements(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()) 
          composeValueSetExpansionParameterComponent("parameter", e);
    }
    if (element.hasProperty()) { 
      for (ValueSet.ValueSetExpansionPropertyComponent e : element.getProperty()) 
          composeValueSetExpansionPropertyComponent("property", e);
    }
    if (element.hasContains()) { 
      for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
          composeValueSetExpansionContainsComponent("contains", e);
    }
  }

  protected void composeValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetExpansionParameterComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetExpansionParameterComponentElements(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasNameElement()) {
      composeString("name", element.getNameElement());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeValueSetExpansionPropertyComponent(String name, ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetExpansionPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetExpansionPropertyComponentElements(ValueSet.ValueSetExpansionPropertyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement()) {
      composeCode("code", element.getCodeElement());
    }
    if (element.hasUriElement()) {
      composeUri("uri", element.getUriElement());
    }
  }

  protected void composeValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetExpansionContainsComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetExpansionContainsComponentElements(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.hasProperty()) { 
      for (ValueSet.ConceptPropertyComponent e : element.getProperty()) 
          composeValueSetConceptPropertyComponent("property", e);
    }
    if (element.hasContains()) { 
      for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
          composeValueSetExpansionContainsComponent("contains", e);
    }
  }

  protected void composeValueSetConceptPropertyComponent(String name, ValueSet.ConceptPropertyComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeValueSetConceptPropertyComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeValueSetConceptPropertyComponentElements(ValueSet.ConceptPropertyComponent element) throws IOException {
    composeBackboneElementElements(element);
    if (element.hasCodeElement()) {
      composeCode("code", element.getCodeElement());
    }
    if (element.hasValue()) {
      composeType("value", element.getValue());
    }  }

  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
    if (element != null) {
    composeResourceAttributes(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()) 
          composeVerificationResultPrimarySourceComponent("primarySource", e);
    }
    if (element.hasAttestation()) {
      composeVerificationResultAttestationComponent("attestation", element.getAttestation());
    }
    if (element.hasValidator()) { 
      for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
          composeVerificationResultValidatorComponent("validator", e);
    }
  }

  protected void composeVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVerificationResultPrimarySourceComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVerificationResultPrimarySourceComponentElements(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 composeVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVerificationResultAttestationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVerificationResultAttestationComponentElements(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 composeVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVerificationResultValidatorComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVerificationResultValidatorComponentElements(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) {
    composeResourceAttributes(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 Enumerations.FinancialResourceStatusCodesEnumFactory());
    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()) 
          composeVisionPrescriptionLensSpecificationComponent("lensSpecification", e);
    }
  }

  protected void composeVisionPrescriptionLensSpecificationComponent(String name, VisionPrescription.VisionPrescriptionLensSpecificationComponent element) throws IOException {
    if (element != null) {
    composeElementAttributes(element);
      xml.enter(FHIR_NS, name);
      composeVisionPrescriptionLensSpecificationComponentElements(element);
      composeElementClose(element);
      xml.exit(FHIR_NS, name);
    }
  }

  protected void composeVisionPrescriptionLensSpecificationComponentElements(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 == null) {
      throw new IOException("resource == null");
    } else if (resource instanceof Account) {
      composeAccount("Account", (Account)resource);
    } else if (resource instanceof ActivityDefinition) {
      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
    } else if (resource instanceof AdministrableProductDefinition) {
      composeAdministrableProductDefinition("AdministrableProductDefinition", (AdministrableProductDefinition)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 CapabilityStatement2) {
      composeCapabilityStatement2("CapabilityStatement2", (CapabilityStatement2)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 Citation) {
      composeCitation("Citation", (Citation)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 ClinicalUseIssue) {
      composeClinicalUseIssue("ClinicalUseIssue", (ClinicalUseIssue)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 ConditionDefinition) {
      composeConditionDefinition("ConditionDefinition", (ConditionDefinition)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 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 EvidenceFocus) {
      composeEvidenceFocus("EvidenceFocus", (EvidenceFocus)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 Ingredient) {
      composeIngredient("Ingredient", (Ingredient)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 ManufacturedItemDefinition) {
      composeManufacturedItemDefinition("ManufacturedItemDefinition", (ManufacturedItemDefinition)resource);
    } else if (resource instanceof Measure) {
      composeMeasure("Measure", (Measure)resource);
    } else if (resource instanceof MeasureReport) {
      composeMeasureReport("MeasureReport", (MeasureReport)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 MedicationUsage) {
      composeMedicationUsage("MedicationUsage", (MedicationUsage)resource);
    } else if (resource instanceof MedicinalProductDefinition) {
      composeMedicinalProductDefinition("MedicinalProductDefinition", (MedicinalProductDefinition)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 NutritionIntake) {
      composeNutritionIntake("NutritionIntake", (NutritionIntake)resource);
    } else if (resource instanceof NutritionOrder) {
      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
    } else if (resource instanceof NutritionProduct) {
      composeNutritionProduct("NutritionProduct", (NutritionProduct)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 PackagedProductDefinition) {
      composePackagedProductDefinition("PackagedProductDefinition", (PackagedProductDefinition)resource);
    } else if (resource instanceof Parameters) {
      composeParameters("Parameters", (Parameters)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 Permission) {
      composePermission("Permission", (Permission)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 RegulatedAuthorization) {
      composeRegulatedAuthorization("RegulatedAuthorization", (RegulatedAuthorization)resource);
    } else if (resource instanceof RelatedPerson) {
      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
    } else if (resource instanceof RequestGroup) {
      composeRequestGroup("RequestGroup", (RequestGroup)resource);
    } else if (resource instanceof ResearchStudy) {
      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
    } else if (resource instanceof ResearchSubject) {
      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
    } else if (resource instanceof RiskAssessment) {
      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
    } else if (resource instanceof Schedule) {
      composeSchedule("Schedule", (Schedule)resource);
    } else if (resource instanceof SearchParameter) {
      composeSearchParameter("SearchParameter", (SearchParameter)resource);
    } else if (resource instanceof 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 SubscriptionStatus) {
      composeSubscriptionStatus("SubscriptionStatus", (SubscriptionStatus)resource);
    } else if (resource instanceof SubscriptionTopic) {
      composeSubscriptionTopic("SubscriptionTopic", (SubscriptionTopic)resource);
    } else if (resource instanceof Substance) {
      composeSubstance("Substance", (Substance)resource);
    } else if (resource instanceof SubstanceDefinition) {
      composeSubstanceDefinition("SubstanceDefinition", (SubstanceDefinition)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 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 {
      throw new Error("Unhandled resource type "+resource.getClass().getName());
    }
  }

  protected void composeResource(String name, Resource resource) throws IOException {
    if (name == null) {
      throw new IOException("name == null");
    } else if (resource == null) {
      throw new IOException("resource == null");
    } else if (resource instanceof Account) {
      composeAccount(name, (Account)resource);
    } else if (resource instanceof ActivityDefinition) {
      composeActivityDefinition(name, (ActivityDefinition)resource);
    } else if (resource instanceof AdministrableProductDefinition) {
      composeAdministrableProductDefinition(name, (AdministrableProductDefinition)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 CapabilityStatement2) {
      composeCapabilityStatement2(name, (CapabilityStatement2)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 Citation) {
      composeCitation(name, (Citation)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 ClinicalUseIssue) {
      composeClinicalUseIssue(name, (ClinicalUseIssue)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 ConditionDefinition) {
      composeConditionDefinition(name, (ConditionDefinition)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 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 EvidenceFocus) {
      composeEvidenceFocus(name, (EvidenceFocus)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 Ingredient) {
      composeIngredient(name, (Ingredient)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 ManufacturedItemDefinition) {
      composeManufacturedItemDefinition(name, (ManufacturedItemDefinition)resource);
    } else if (resource instanceof Measure) {
      composeMeasure(name, (Measure)resource);
    } else if (resource instanceof MeasureReport) {
      composeMeasureReport(name, (MeasureReport)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 MedicationUsage) {
      composeMedicationUsage(name, (MedicationUsage)resource);
    } else if (resource instanceof MedicinalProductDefinition) {
      composeMedicinalProductDefinition(name, (MedicinalProductDefinition)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 NutritionIntake) {
      composeNutritionIntake(name, (NutritionIntake)resource);
    } else if (resource instanceof NutritionOrder) {
      composeNutritionOrder(name, (NutritionOrder)resource);
    } else if (resource instanceof NutritionProduct) {
      composeNutritionProduct(name, (NutritionProduct)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 PackagedProductDefinition) {
      composePackagedProductDefinition(name, (PackagedProductDefinition)resource);
    } else if (resource instanceof Parameters) {
      composeParameters(name, (Parameters)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 Permission) {
      composePermission(name, (Permission)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 RegulatedAuthorization) {
      composeRegulatedAuthorization(name, (RegulatedAuthorization)resource);
    } else if (resource instanceof RelatedPerson) {
      composeRelatedPerson(name, (RelatedPerson)resource);
    } else if (resource instanceof RequestGroup) {
      composeRequestGroup(name, (RequestGroup)resource);
    } else if (resource instanceof ResearchStudy) {
      composeResearchStudy(name, (ResearchStudy)resource);
    } else if (resource instanceof ResearchSubject) {
      composeResearchSubject(name, (ResearchSubject)resource);
    } else if (resource instanceof RiskAssessment) {
      composeRiskAssessment(name, (RiskAssessment)resource);
    } else if (resource instanceof Schedule) {
      composeSchedule(name, (Schedule)resource);
    } else if (resource instanceof SearchParameter) {
      composeSearchParameter(name, (SearchParameter)resource);
    } else if (resource instanceof 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 SubscriptionStatus) {
      composeSubscriptionStatus(name, (SubscriptionStatus)resource);
    } else if (resource instanceof SubscriptionTopic) {
      composeSubscriptionTopic(name, (SubscriptionTopic)resource);
    } else if (resource instanceof Substance) {
      composeSubstance(name, (Substance)resource);
    } else if (resource instanceof SubstanceDefinition) {
      composeSubstanceDefinition(name, (SubstanceDefinition)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 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 {
      throw new Error("Unhandled resource type "+resource.getClass().getName());
    }
  }

  protected void composeType(String prefix, DataType type) throws IOException {
    if (prefix == null) {
      throw new IOException("prefix == null");
    } else if (type == null) {
      throw new IOException("type == null");
    } else if (type instanceof Address) {
       composeAddress(prefix+"Address", (Address) type);
    } else if (type instanceof Age) {
       composeAge(prefix+"Age", (Age) type);
    } else if (type instanceof Annotation) {
       composeAnnotation(prefix+"Annotation", (Annotation) type);
    } else if (type instanceof Attachment) {
       composeAttachment(prefix+"Attachment", (Attachment) type);
    } else if (type instanceof CodeableConcept) {
       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
    } else if (type instanceof CodeableReference) {
       composeCodeableReference(prefix+"CodeableReference", (CodeableReference) type);
    } else if (type instanceof Coding) {
       composeCoding(prefix+"Coding", (Coding) type);
    } else if (type instanceof ContactDetail) {
       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
    } else if (type instanceof ContactPoint) {
       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
    } else if (type instanceof Contributor) {
       composeContributor(prefix+"Contributor", (Contributor) type);
    } else if (type instanceof Count) {
       composeCount(prefix+"Count", (Count) type);
    } else if (type instanceof DataRequirement) {
       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
    } else if (type instanceof Distance) {
       composeDistance(prefix+"Distance", (Distance) type);
    } else if (type instanceof Dosage) {
       composeDosage(prefix+"Dosage", (Dosage) type);
    } else if (type instanceof Duration) {
       composeDuration(prefix+"Duration", (Duration) type);
    } else if (type instanceof ElementDefinition) {
       composeElementDefinition(prefix+"ElementDefinition", (ElementDefinition) type);
    } else if (type instanceof Expression) {
       composeExpression(prefix+"Expression", (Expression) type);
    } else if (type instanceof Extension) {
       composeExtension(prefix+"Extension", (Extension) type);
    } else if (type instanceof HumanName) {
       composeHumanName(prefix+"HumanName", (HumanName) type);
    } else if (type instanceof Identifier) {
       composeIdentifier(prefix+"Identifier", (Identifier) type);
    } else if (type instanceof MarketingStatus) {
       composeMarketingStatus(prefix+"MarketingStatus", (MarketingStatus) type);
    } else if (type instanceof Meta) {
       composeMeta(prefix+"Meta", (Meta) type);
    } else if (type instanceof Money) {
       composeMoney(prefix+"Money", (Money) type);
    } else if (type instanceof Narrative) {
       composeNarrative(prefix+"Narrative", (Narrative) type);
    } else if (type instanceof OrderedDistribution) {
       composeOrderedDistribution(prefix+"OrderedDistribution", (OrderedDistribution) type);
    } else if (type instanceof ParameterDefinition) {
       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
    } else if (type instanceof Period) {
       composePeriod(prefix+"Period", (Period) type);
    } else if (type instanceof Population) {
       composePopulation(prefix+"Population", (Population) type);
    } else if (type instanceof ProdCharacteristic) {
       composeProdCharacteristic(prefix+"ProdCharacteristic", (ProdCharacteristic) type);
    } else if (type instanceof ProductShelfLife) {
       composeProductShelfLife(prefix+"ProductShelfLife", (ProductShelfLife) type);
    } else if (type instanceof Quantity) {
       composeQuantity(prefix+"Quantity", (Quantity) type);
    } else if (type instanceof Range) {
       composeRange(prefix+"Range", (Range) 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 RelatedArtifact) {
       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
    } else if (type instanceof SampledData) {
       composeSampledData(prefix+"SampledData", (SampledData) type);
    } else if (type instanceof Signature) {
       composeSignature(prefix+"Signature", (Signature) type);
    } else if (type instanceof Statistic) {
       composeStatistic(prefix+"Statistic", (Statistic) type);
    } else if (type instanceof SubstanceAmount) {
       composeSubstanceAmount(prefix+"SubstanceAmount", (SubstanceAmount) type);
    } else if (type instanceof Timing) {
       composeTiming(prefix+"Timing", (Timing) type);
    } else if (type instanceof TriggerDefinition) {
       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
    } else if (type instanceof UsageContext) {
       composeUsageContext(prefix+"UsageContext", (UsageContext) 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 Integer64Type) {
      composeInteger64(prefix+"Integer64", (Integer64Type) 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 "+type.fhirType());
    }
  }

}