001package org.hl7.fhir.r5.formats;
002
003// generated
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, \
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this \
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, \
015     this list of conditions and the following disclaimer in the documentation \
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
030  POSSIBILITY OF SUCH DAMAGE.
031  */
032
033// Generated on Sat, Nov 5, 2022 10:47+1100 for FHIR v5.0.0-ballot
034
035
036
037import org.hl7.fhir.r5.model.*;
038import org.hl7.fhir.r5.model.Enumerations.FHIRVersion;
039import org.xmlpull.v1.*;
040import org.hl7.fhir.utilities.Utilities;
041import org.hl7.fhir.exceptions.FHIRFormatError;
042import org.hl7.fhir.exceptions.FHIRException;
043import java.io.IOException;
044
045public class XmlParser extends XmlParserBase {
046
047  public XmlParser() {
048    super();
049  }
050
051  public XmlParser(boolean allowUnknownContent) {
052    super();
053    setAllowUnknownContent(allowUnknownContent);
054  }
055
056  protected boolean parseBaseContent(int eventType, XmlPullParser xpp, Base res) throws XmlPullParserException, IOException, FHIRFormatError {
057    return false;
058  }
059
060  @SuppressWarnings("unchecked")
061  protected <E extends Enum<E>> Enumeration<E> parseEnumeration(XmlPullParser xpp, E item, EnumFactory e) throws XmlPullParserException, IOException, FHIRFormatError {
062    Enumeration<E> res = new Enumeration<E>(e);
063    parseElementAttributes(xpp, res);
064    res.setValue((E) e.fromCode(xpp.getAttributeValue(null, "value")));
065    next(xpp);
066    int eventType = nextNoWhitespace(xpp);
067    while (eventType != XmlPullParser.END_TAG) {
068      if (!parseElementContent(eventType, xpp, res))
069        unknownContent(xpp);
070      eventType = nextNoWhitespace(xpp);
071    }
072    next(xpp);
073    parseElementClose(res);
074    return res;
075  }
076
077  protected DateType parseDate(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
078    DateType res = new DateType(xpp.getAttributeValue(null, "value"));
079    parseElementAttributes(xpp, res);
080    next(xpp);
081    int eventType = nextNoWhitespace(xpp);
082    while (eventType != XmlPullParser.END_TAG) {
083      if (!parseElementContent(eventType, xpp, res))
084        unknownContent(xpp);
085      eventType = nextNoWhitespace(xpp);
086    }
087    next(xpp);
088    parseElementClose(res);
089    return res;
090  }
091
092  protected DateTimeType parseDateTime(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
093    DateTimeType res = new DateTimeType(xpp.getAttributeValue(null, "value"));
094    parseElementAttributes(xpp, res);
095    next(xpp);
096    int eventType = nextNoWhitespace(xpp);
097    while (eventType != XmlPullParser.END_TAG) {
098      if (!parseElementContent(eventType, xpp, res))
099        unknownContent(xpp);
100      eventType = nextNoWhitespace(xpp);
101    }
102    next(xpp);
103    parseElementClose(res);
104    return res;
105  }
106
107  protected CodeType parseCode(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
108    CodeType res = new CodeType(xpp.getAttributeValue(null, "value"));
109    parseElementAttributes(xpp, res);
110    next(xpp);
111    int eventType = nextNoWhitespace(xpp);
112    while (eventType != XmlPullParser.END_TAG) {
113      if (!parseElementContent(eventType, xpp, res))
114        unknownContent(xpp);
115      eventType = nextNoWhitespace(xpp);
116    }
117    next(xpp);
118    parseElementClose(res);
119    return res;
120  }
121
122  protected StringType parseString(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
123    StringType res = new StringType(xpp.getAttributeValue(null, "value"));
124    parseElementAttributes(xpp, res);
125    next(xpp);
126    int eventType = nextNoWhitespace(xpp);
127    while (eventType != XmlPullParser.END_TAG) {
128      if (!parseElementContent(eventType, xpp, res))
129        unknownContent(xpp);
130      eventType = nextNoWhitespace(xpp);
131    }
132    next(xpp);
133    parseElementClose(res);
134    return res;
135  }
136
137  protected IntegerType parseInteger(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
138    IntegerType res = new IntegerType(xpp.getAttributeValue(null, "value"));
139    parseElementAttributes(xpp, res);
140    next(xpp);
141    int eventType = nextNoWhitespace(xpp);
142    while (eventType != XmlPullParser.END_TAG) {
143      if (!parseElementContent(eventType, xpp, res))
144        unknownContent(xpp);
145      eventType = nextNoWhitespace(xpp);
146    }
147    next(xpp);
148    parseElementClose(res);
149    return res;
150  }
151
152  protected Integer64Type parseInteger64(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
153    Integer64Type res = new Integer64Type(xpp.getAttributeValue(null, "value"));
154    parseElementAttributes(xpp, res);
155    next(xpp);
156    int eventType = nextNoWhitespace(xpp);
157    while (eventType != XmlPullParser.END_TAG) {
158      if (!parseElementContent(eventType, xpp, res))
159        unknownContent(xpp);
160      eventType = nextNoWhitespace(xpp);
161    }
162    next(xpp);
163    parseElementClose(res);
164    return res;
165  }
166
167  protected OidType parseOid(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
168    OidType res = new OidType(xpp.getAttributeValue(null, "value"));
169    parseElementAttributes(xpp, res);
170    next(xpp);
171    int eventType = nextNoWhitespace(xpp);
172    while (eventType != XmlPullParser.END_TAG) {
173      if (!parseElementContent(eventType, xpp, res))
174        unknownContent(xpp);
175      eventType = nextNoWhitespace(xpp);
176    }
177    next(xpp);
178    parseElementClose(res);
179    return res;
180  }
181
182  protected CanonicalType parseCanonical(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
183    CanonicalType res = new CanonicalType(xpp.getAttributeValue(null, "value"));
184    parseElementAttributes(xpp, res);
185    next(xpp);
186    int eventType = nextNoWhitespace(xpp);
187    while (eventType != XmlPullParser.END_TAG) {
188      if (!parseElementContent(eventType, xpp, res))
189        unknownContent(xpp);
190      eventType = nextNoWhitespace(xpp);
191    }
192    next(xpp);
193    parseElementClose(res);
194    return res;
195  }
196
197  protected UriType parseUri(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
198    UriType res = new UriType(xpp.getAttributeValue(null, "value"));
199    parseElementAttributes(xpp, res);
200    next(xpp);
201    int eventType = nextNoWhitespace(xpp);
202    while (eventType != XmlPullParser.END_TAG) {
203      if (!parseElementContent(eventType, xpp, res))
204        unknownContent(xpp);
205      eventType = nextNoWhitespace(xpp);
206    }
207    next(xpp);
208    parseElementClose(res);
209    return res;
210  }
211
212  protected UuidType parseUuid(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
213    UuidType res = new UuidType(xpp.getAttributeValue(null, "value"));
214    parseElementAttributes(xpp, res);
215    next(xpp);
216    int eventType = nextNoWhitespace(xpp);
217    while (eventType != XmlPullParser.END_TAG) {
218      if (!parseElementContent(eventType, xpp, res))
219        unknownContent(xpp);
220      eventType = nextNoWhitespace(xpp);
221    }
222    next(xpp);
223    parseElementClose(res);
224    return res;
225  }
226
227  protected UrlType parseUrl(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
228    UrlType res = new UrlType(xpp.getAttributeValue(null, "value"));
229    parseElementAttributes(xpp, res);
230    next(xpp);
231    int eventType = nextNoWhitespace(xpp);
232    while (eventType != XmlPullParser.END_TAG) {
233      if (!parseElementContent(eventType, xpp, res))
234        unknownContent(xpp);
235      eventType = nextNoWhitespace(xpp);
236    }
237    next(xpp);
238    parseElementClose(res);
239    return res;
240  }
241
242  protected InstantType parseInstant(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
243    InstantType res = new InstantType(xpp.getAttributeValue(null, "value"));
244    parseElementAttributes(xpp, res);
245    next(xpp);
246    int eventType = nextNoWhitespace(xpp);
247    while (eventType != XmlPullParser.END_TAG) {
248      if (!parseElementContent(eventType, xpp, res))
249        unknownContent(xpp);
250      eventType = nextNoWhitespace(xpp);
251    }
252    next(xpp);
253    parseElementClose(res);
254    return res;
255  }
256
257  protected BooleanType parseBoolean(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
258    BooleanType res = new BooleanType(xpp.getAttributeValue(null, "value"));
259    parseElementAttributes(xpp, res);
260    next(xpp);
261    int eventType = nextNoWhitespace(xpp);
262    while (eventType != XmlPullParser.END_TAG) {
263      if (!parseElementContent(eventType, xpp, res))
264        unknownContent(xpp);
265      eventType = nextNoWhitespace(xpp);
266    }
267    next(xpp);
268    parseElementClose(res);
269    return res;
270  }
271
272  protected Base64BinaryType parseBase64Binary(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
273    Base64BinaryType res = new Base64BinaryType(xpp.getAttributeValue(null, "value"));
274    parseElementAttributes(xpp, res);
275    next(xpp);
276    int eventType = nextNoWhitespace(xpp);
277    while (eventType != XmlPullParser.END_TAG) {
278      if (!parseElementContent(eventType, xpp, res))
279        unknownContent(xpp);
280      eventType = nextNoWhitespace(xpp);
281    }
282    next(xpp);
283    parseElementClose(res);
284    return res;
285  }
286
287  protected UnsignedIntType parseUnsignedInt(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
288    UnsignedIntType res = new UnsignedIntType(xpp.getAttributeValue(null, "value"));
289    parseElementAttributes(xpp, res);
290    next(xpp);
291    int eventType = nextNoWhitespace(xpp);
292    while (eventType != XmlPullParser.END_TAG) {
293      if (!parseElementContent(eventType, xpp, res))
294        unknownContent(xpp);
295      eventType = nextNoWhitespace(xpp);
296    }
297    next(xpp);
298    parseElementClose(res);
299    return res;
300  }
301
302  protected MarkdownType parseMarkdown(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
303    MarkdownType res = new MarkdownType(xpp.getAttributeValue(null, "value"));
304    parseElementAttributes(xpp, res);
305    next(xpp);
306    int eventType = nextNoWhitespace(xpp);
307    while (eventType != XmlPullParser.END_TAG) {
308      if (!parseElementContent(eventType, xpp, res))
309        unknownContent(xpp);
310      eventType = nextNoWhitespace(xpp);
311    }
312    next(xpp);
313    parseElementClose(res);
314    return res;
315  }
316
317  protected TimeType parseTime(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
318    TimeType res = new TimeType(xpp.getAttributeValue(null, "value"));
319    parseElementAttributes(xpp, res);
320    next(xpp);
321    int eventType = nextNoWhitespace(xpp);
322    while (eventType != XmlPullParser.END_TAG) {
323      if (!parseElementContent(eventType, xpp, res))
324        unknownContent(xpp);
325      eventType = nextNoWhitespace(xpp);
326    }
327    next(xpp);
328    parseElementClose(res);
329    return res;
330  }
331
332  protected IdType parseId(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
333    IdType res = new IdType(xpp.getAttributeValue(null, "value"));
334    parseElementAttributes(xpp, res);
335    next(xpp);
336    int eventType = nextNoWhitespace(xpp);
337    while (eventType != XmlPullParser.END_TAG) {
338      if (!parseElementContent(eventType, xpp, res))
339        unknownContent(xpp);
340      eventType = nextNoWhitespace(xpp);
341    }
342    next(xpp);
343    parseElementClose(res);
344    return res;
345  }
346
347  protected PositiveIntType parsePositiveInt(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
348    PositiveIntType res = new PositiveIntType(xpp.getAttributeValue(null, "value"));
349    parseElementAttributes(xpp, res);
350    next(xpp);
351    int eventType = nextNoWhitespace(xpp);
352    while (eventType != XmlPullParser.END_TAG) {
353      if (!parseElementContent(eventType, xpp, res))
354        unknownContent(xpp);
355      eventType = nextNoWhitespace(xpp);
356    }
357    next(xpp);
358    parseElementClose(res);
359    return res;
360  }
361
362  protected DecimalType parseDecimal(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
363    DecimalType res = new DecimalType(xpp.getAttributeValue(null, "value"));
364    parseElementAttributes(xpp, res);
365    next(xpp);
366    int eventType = nextNoWhitespace(xpp);
367    while (eventType != XmlPullParser.END_TAG) {
368      if (!parseElementContent(eventType, xpp, res))
369        unknownContent(xpp);
370      eventType = nextNoWhitespace(xpp);
371    }
372    next(xpp);
373    parseElementClose(res);
374    return res;
375  }
376
377  protected boolean parseBackboneElementContent(int eventType, XmlPullParser xpp, BackboneElement res) throws XmlPullParserException, IOException, FHIRFormatError {
378    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifierExtension")) {
379      res.getModifierExtension().add(parseExtension(xpp));
380    } else if (!parseElementContent(eventType, xpp, res)){ 
381        return false;
382    }
383    return true;
384  }
385
386  protected boolean parseBackboneTypeContent(int eventType, XmlPullParser xpp, BackboneType res) throws XmlPullParserException, IOException, FHIRFormatError {
387    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifierExtension")) {
388      res.getModifierExtension().add(parseExtension(xpp));
389    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
390        return false;
391    }
392    return true;
393  }
394
395  protected boolean parseDataTypeContent(int eventType, XmlPullParser xpp, DataType res) throws XmlPullParserException, IOException, FHIRFormatError {
396    if (!parseElementContent(eventType, xpp, res)){ 
397        return false;
398    }
399    return true;
400  }
401
402  protected boolean parseElementContent(int eventType, XmlPullParser xpp, Element res) throws XmlPullParserException, IOException, FHIRFormatError {
403    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extension")) {
404      res.getExtension().add(parseExtension(xpp));
405    } else if (!parseBaseContent(eventType, xpp, res)){ 
406        return false;
407    }
408    return true;
409  }
410
411  protected Address parseAddress(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
412    Address res = new Address();
413    parseElementAttributes(xpp, res);
414    next(xpp);
415    int eventType = nextNoWhitespace(xpp);
416    while (eventType != XmlPullParser.END_TAG) {
417    if (!parseAddressContent(eventType, xpp, res))
418        unknownContent(xpp);
419      eventType = nextNoWhitespace(xpp);
420    }
421    next(xpp);
422    parseElementClose(res);
423    return res;
424  }
425
426  protected boolean parseAddressContent(int eventType, XmlPullParser xpp, Address res) throws XmlPullParserException, IOException, FHIRFormatError {
427    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
428      res.setUseElement(parseEnumeration(xpp, Address.AddressUse.NULL, new Address.AddressUseEnumFactory()));
429    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
430      res.setTypeElement(parseEnumeration(xpp, Address.AddressType.NULL, new Address.AddressTypeEnumFactory()));
431    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
432      res.setTextElement(parseString(xpp));
433    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("line")) {
434      res.getLine().add(parseString(xpp));
435    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("city")) {
436      res.setCityElement(parseString(xpp));
437    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("district")) {
438      res.setDistrictElement(parseString(xpp));
439    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("state")) {
440      res.setStateElement(parseString(xpp));
441    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("postalCode")) {
442      res.setPostalCodeElement(parseString(xpp));
443    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
444      res.setCountryElement(parseString(xpp));
445    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
446      res.setPeriod(parsePeriod(xpp));
447    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
448      return false;
449    }
450    return true;
451  }
452
453  protected Age parseAge(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
454    Age res = new Age();
455    parseElementAttributes(xpp, res);
456    next(xpp);
457    int eventType = nextNoWhitespace(xpp);
458    while (eventType != XmlPullParser.END_TAG) {
459    if (!parseAgeContent(eventType, xpp, res))
460        unknownContent(xpp);
461      eventType = nextNoWhitespace(xpp);
462    }
463    next(xpp);
464    parseElementClose(res);
465    return res;
466  }
467
468  protected boolean parseAgeContent(int eventType, XmlPullParser xpp, Age res) throws XmlPullParserException, IOException, FHIRFormatError {
469    if (!parseQuantityContent(eventType, xpp, res)){ 
470      return false;
471    }
472    return true;
473  }
474
475  protected Annotation parseAnnotation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
476    Annotation res = new Annotation();
477    parseElementAttributes(xpp, res);
478    next(xpp);
479    int eventType = nextNoWhitespace(xpp);
480    while (eventType != XmlPullParser.END_TAG) {
481    if (!parseAnnotationContent(eventType, xpp, res))
482        unknownContent(xpp);
483      eventType = nextNoWhitespace(xpp);
484    }
485    next(xpp);
486    parseElementClose(res);
487    return res;
488  }
489
490  protected boolean parseAnnotationContent(int eventType, XmlPullParser xpp, Annotation res) throws XmlPullParserException, IOException, FHIRFormatError {
491    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "author")) {
492      res.setAuthor(parseType("author", xpp));
493    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
494      res.setTimeElement(parseDateTime(xpp));
495    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
496      res.setTextElement(parseMarkdown(xpp));
497    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
498      return false;
499    }
500    return true;
501  }
502
503  protected Attachment parseAttachment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
504    Attachment res = new Attachment();
505    parseElementAttributes(xpp, res);
506    next(xpp);
507    int eventType = nextNoWhitespace(xpp);
508    while (eventType != XmlPullParser.END_TAG) {
509    if (!parseAttachmentContent(eventType, xpp, res))
510        unknownContent(xpp);
511      eventType = nextNoWhitespace(xpp);
512    }
513    next(xpp);
514    parseElementClose(res);
515    return res;
516  }
517
518  protected boolean parseAttachmentContent(int eventType, XmlPullParser xpp, Attachment res) throws XmlPullParserException, IOException, FHIRFormatError {
519    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
520      res.setContentTypeElement(parseCode(xpp));
521    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
522      res.setLanguageElement(parseCode(xpp));
523    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
524      res.setDataElement(parseBase64Binary(xpp));
525    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
526      res.setUrlElement(parseUrl(xpp));
527    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("size")) {
528      res.setSizeElement(parseInteger64(xpp));
529    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hash")) {
530      res.setHashElement(parseBase64Binary(xpp));
531    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
532      res.setTitleElement(parseString(xpp));
533    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("creation")) {
534      res.setCreationElement(parseDateTime(xpp));
535    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("height")) {
536      res.setHeightElement(parsePositiveInt(xpp));
537    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("width")) {
538      res.setWidthElement(parsePositiveInt(xpp));
539    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frames")) {
540      res.setFramesElement(parsePositiveInt(xpp));
541    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
542      res.setDurationElement(parseDecimal(xpp));
543    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pages")) {
544      res.setPagesElement(parsePositiveInt(xpp));
545    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
546      return false;
547    }
548    return true;
549  }
550
551  protected Availability parseAvailability(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
552    Availability res = new Availability();
553    parseElementAttributes(xpp, res);
554    next(xpp);
555    int eventType = nextNoWhitespace(xpp);
556    while (eventType != XmlPullParser.END_TAG) {
557    if (!parseAvailabilityContent(eventType, xpp, res))
558        unknownContent(xpp);
559      eventType = nextNoWhitespace(xpp);
560    }
561    next(xpp);
562    parseElementClose(res);
563    return res;
564  }
565
566  protected boolean parseAvailabilityContent(int eventType, XmlPullParser xpp, Availability res) throws XmlPullParserException, IOException, FHIRFormatError {
567    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableTime")) {
568      res.getAvailableTime().add(parseAvailabilityAvailableTimeComponent(xpp));
569    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("notAvailableTime")) {
570      res.getNotAvailableTime().add(parseAvailabilityNotAvailableTimeComponent(xpp));
571    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
572      return false;
573    }
574    return true;
575  }
576
577  protected Availability.AvailabilityAvailableTimeComponent parseAvailabilityAvailableTimeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
578    Availability.AvailabilityAvailableTimeComponent res = new Availability.AvailabilityAvailableTimeComponent();
579    parseElementAttributes(xpp, res);
580    next(xpp);
581    int eventType = nextNoWhitespace(xpp);
582    while (eventType != XmlPullParser.END_TAG) {
583    if (!parseAvailabilityAvailableTimeComponentContent(eventType, xpp, res))
584        unknownContent(xpp);
585      eventType = nextNoWhitespace(xpp);
586    }
587    next(xpp);
588    parseElementClose(res);
589    return res;
590  }
591
592  protected boolean parseAvailabilityAvailableTimeComponentContent(int eventType, XmlPullParser xpp, Availability.AvailabilityAvailableTimeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
593    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("daysOfWeek")) {
594      res.getDaysOfWeek().add(parseEnumeration(xpp, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
595    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("allDay")) {
596      res.setAllDayElement(parseBoolean(xpp));
597    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableStartTime")) {
598      res.setAvailableStartTimeElement(parseTime(xpp));
599    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("availableEndTime")) {
600      res.setAvailableEndTimeElement(parseTime(xpp));
601    } else if (!parseElementContent(eventType, xpp, res)){ 
602      return false;
603    }
604    return true;
605  }
606
607  protected Availability.AvailabilityNotAvailableTimeComponent parseAvailabilityNotAvailableTimeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
608    Availability.AvailabilityNotAvailableTimeComponent res = new Availability.AvailabilityNotAvailableTimeComponent();
609    parseElementAttributes(xpp, res);
610    next(xpp);
611    int eventType = nextNoWhitespace(xpp);
612    while (eventType != XmlPullParser.END_TAG) {
613    if (!parseAvailabilityNotAvailableTimeComponentContent(eventType, xpp, res))
614        unknownContent(xpp);
615      eventType = nextNoWhitespace(xpp);
616    }
617    next(xpp);
618    parseElementClose(res);
619    return res;
620  }
621
622  protected boolean parseAvailabilityNotAvailableTimeComponentContent(int eventType, XmlPullParser xpp, Availability.AvailabilityNotAvailableTimeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
623    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
624      res.setDescriptionElement(parseString(xpp));
625    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("during")) {
626      res.setDuring(parsePeriod(xpp));
627    } else if (!parseElementContent(eventType, xpp, res)){ 
628      return false;
629    }
630    return true;
631  }
632
633  protected CodeableConcept parseCodeableConcept(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
634    CodeableConcept res = new CodeableConcept();
635    parseElementAttributes(xpp, res);
636    next(xpp);
637    int eventType = nextNoWhitespace(xpp);
638    while (eventType != XmlPullParser.END_TAG) {
639    if (!parseCodeableConceptContent(eventType, xpp, res))
640        unknownContent(xpp);
641      eventType = nextNoWhitespace(xpp);
642    }
643    next(xpp);
644    parseElementClose(res);
645    return res;
646  }
647
648  protected boolean parseCodeableConceptContent(int eventType, XmlPullParser xpp, CodeableConcept res) throws XmlPullParserException, IOException, FHIRFormatError {
649    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coding")) {
650      res.getCoding().add(parseCoding(xpp));
651    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
652      res.setTextElement(parseString(xpp));
653    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
654      return false;
655    }
656    return true;
657  }
658
659  protected CodeableReference parseCodeableReference(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
660    CodeableReference res = new CodeableReference();
661    parseElementAttributes(xpp, res);
662    next(xpp);
663    int eventType = nextNoWhitespace(xpp);
664    while (eventType != XmlPullParser.END_TAG) {
665    if (!parseCodeableReferenceContent(eventType, xpp, res))
666        unknownContent(xpp);
667      eventType = nextNoWhitespace(xpp);
668    }
669    next(xpp);
670    parseElementClose(res);
671    return res;
672  }
673
674  protected boolean parseCodeableReferenceContent(int eventType, XmlPullParser xpp, CodeableReference res) throws XmlPullParserException, IOException, FHIRFormatError {
675    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
676      res.setConcept(parseCodeableConcept(xpp));
677    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
678      res.setReference(parseReference(xpp));
679    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
680      return false;
681    }
682    return true;
683  }
684
685  protected Coding parseCoding(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
686    Coding res = new Coding();
687    parseElementAttributes(xpp, res);
688    next(xpp);
689    int eventType = nextNoWhitespace(xpp);
690    while (eventType != XmlPullParser.END_TAG) {
691    if (!parseCodingContent(eventType, xpp, res))
692        unknownContent(xpp);
693      eventType = nextNoWhitespace(xpp);
694    }
695    next(xpp);
696    parseElementClose(res);
697    return res;
698  }
699
700  protected boolean parseCodingContent(int eventType, XmlPullParser xpp, Coding res) throws XmlPullParserException, IOException, FHIRFormatError {
701    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
702      res.setSystemElement(parseUri(xpp));
703    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
704      res.setVersionElement(parseString(xpp));
705    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
706      res.setCodeElement(parseCode(xpp));
707    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
708      res.setDisplayElement(parseString(xpp));
709    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("userSelected")) {
710      res.setUserSelectedElement(parseBoolean(xpp));
711    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
712      return false;
713    }
714    return true;
715  }
716
717  protected ContactDetail parseContactDetail(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
718    ContactDetail res = new ContactDetail();
719    parseElementAttributes(xpp, res);
720    next(xpp);
721    int eventType = nextNoWhitespace(xpp);
722    while (eventType != XmlPullParser.END_TAG) {
723    if (!parseContactDetailContent(eventType, xpp, res))
724        unknownContent(xpp);
725      eventType = nextNoWhitespace(xpp);
726    }
727    next(xpp);
728    parseElementClose(res);
729    return res;
730  }
731
732  protected boolean parseContactDetailContent(int eventType, XmlPullParser xpp, ContactDetail res) throws XmlPullParserException, IOException, FHIRFormatError {
733    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
734      res.setNameElement(parseString(xpp));
735    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
736      res.getTelecom().add(parseContactPoint(xpp));
737    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
738      return false;
739    }
740    return true;
741  }
742
743  protected ContactPoint parseContactPoint(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
744    ContactPoint res = new ContactPoint();
745    parseElementAttributes(xpp, res);
746    next(xpp);
747    int eventType = nextNoWhitespace(xpp);
748    while (eventType != XmlPullParser.END_TAG) {
749    if (!parseContactPointContent(eventType, xpp, res))
750        unknownContent(xpp);
751      eventType = nextNoWhitespace(xpp);
752    }
753    next(xpp);
754    parseElementClose(res);
755    return res;
756  }
757
758  protected boolean parseContactPointContent(int eventType, XmlPullParser xpp, ContactPoint res) throws XmlPullParserException, IOException, FHIRFormatError {
759    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
760      res.setSystemElement(parseEnumeration(xpp, ContactPoint.ContactPointSystem.NULL, new ContactPoint.ContactPointSystemEnumFactory()));
761    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
762      res.setValueElement(parseString(xpp));
763    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
764      res.setUseElement(parseEnumeration(xpp, ContactPoint.ContactPointUse.NULL, new ContactPoint.ContactPointUseEnumFactory()));
765    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rank")) {
766      res.setRankElement(parsePositiveInt(xpp));
767    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
768      res.setPeriod(parsePeriod(xpp));
769    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
770      return false;
771    }
772    return true;
773  }
774
775  protected Contributor parseContributor(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
776    Contributor res = new Contributor();
777    parseElementAttributes(xpp, res);
778    next(xpp);
779    int eventType = nextNoWhitespace(xpp);
780    while (eventType != XmlPullParser.END_TAG) {
781    if (!parseContributorContent(eventType, xpp, res))
782        unknownContent(xpp);
783      eventType = nextNoWhitespace(xpp);
784    }
785    next(xpp);
786    parseElementClose(res);
787    return res;
788  }
789
790  protected boolean parseContributorContent(int eventType, XmlPullParser xpp, Contributor res) throws XmlPullParserException, IOException, FHIRFormatError {
791    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
792      res.setTypeElement(parseEnumeration(xpp, Contributor.ContributorType.NULL, new Contributor.ContributorTypeEnumFactory()));
793    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
794      res.setNameElement(parseString(xpp));
795    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
796      res.getContact().add(parseContactDetail(xpp));
797    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
798      return false;
799    }
800    return true;
801  }
802
803  protected Count parseCount(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
804    Count res = new Count();
805    parseElementAttributes(xpp, res);
806    next(xpp);
807    int eventType = nextNoWhitespace(xpp);
808    while (eventType != XmlPullParser.END_TAG) {
809    if (!parseCountContent(eventType, xpp, res))
810        unknownContent(xpp);
811      eventType = nextNoWhitespace(xpp);
812    }
813    next(xpp);
814    parseElementClose(res);
815    return res;
816  }
817
818  protected boolean parseCountContent(int eventType, XmlPullParser xpp, Count res) throws XmlPullParserException, IOException, FHIRFormatError {
819    if (!parseQuantityContent(eventType, xpp, res)){ 
820      return false;
821    }
822    return true;
823  }
824
825  protected DataRequirement parseDataRequirement(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
826    DataRequirement res = new DataRequirement();
827    parseElementAttributes(xpp, res);
828    next(xpp);
829    int eventType = nextNoWhitespace(xpp);
830    while (eventType != XmlPullParser.END_TAG) {
831    if (!parseDataRequirementContent(eventType, xpp, res))
832        unknownContent(xpp);
833      eventType = nextNoWhitespace(xpp);
834    }
835    next(xpp);
836    parseElementClose(res);
837    return res;
838  }
839
840  protected boolean parseDataRequirementContent(int eventType, XmlPullParser xpp, DataRequirement res) throws XmlPullParserException, IOException, FHIRFormatError {
841    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
842      res.setTypeElement(parseEnumeration(xpp, Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
843    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
844      res.getProfile().add(parseCanonical(xpp));
845    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "subject")) {
846      res.setSubject(parseType("subject", xpp));
847    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mustSupport")) {
848      res.getMustSupport().add(parseString(xpp));
849    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("codeFilter")) {
850      res.getCodeFilter().add(parseDataRequirementCodeFilterComponent(xpp));
851    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateFilter")) {
852      res.getDateFilter().add(parseDataRequirementDateFilterComponent(xpp));
853    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueFilter")) {
854      res.getValueFilter().add(parseDataRequirementValueFilterComponent(xpp));
855    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("limit")) {
856      res.setLimitElement(parsePositiveInt(xpp));
857    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sort")) {
858      res.getSort().add(parseDataRequirementSortComponent(xpp));
859    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
860      return false;
861    }
862    return true;
863  }
864
865  protected DataRequirement.DataRequirementCodeFilterComponent parseDataRequirementCodeFilterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
866    DataRequirement.DataRequirementCodeFilterComponent res = new DataRequirement.DataRequirementCodeFilterComponent();
867    parseElementAttributes(xpp, res);
868    next(xpp);
869    int eventType = nextNoWhitespace(xpp);
870    while (eventType != XmlPullParser.END_TAG) {
871    if (!parseDataRequirementCodeFilterComponentContent(eventType, xpp, res))
872        unknownContent(xpp);
873      eventType = nextNoWhitespace(xpp);
874    }
875    next(xpp);
876    parseElementClose(res);
877    return res;
878  }
879
880  protected boolean parseDataRequirementCodeFilterComponentContent(int eventType, XmlPullParser xpp, DataRequirement.DataRequirementCodeFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
881    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
882      res.setPathElement(parseString(xpp));
883    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
884      res.setSearchParamElement(parseString(xpp));
885    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
886      res.setValueSetElement(parseCanonical(xpp));
887    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
888      res.getCode().add(parseCoding(xpp));
889    } else if (!parseElementContent(eventType, xpp, res)){ 
890      return false;
891    }
892    return true;
893  }
894
895  protected DataRequirement.DataRequirementDateFilterComponent parseDataRequirementDateFilterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
896    DataRequirement.DataRequirementDateFilterComponent res = new DataRequirement.DataRequirementDateFilterComponent();
897    parseElementAttributes(xpp, res);
898    next(xpp);
899    int eventType = nextNoWhitespace(xpp);
900    while (eventType != XmlPullParser.END_TAG) {
901    if (!parseDataRequirementDateFilterComponentContent(eventType, xpp, res))
902        unknownContent(xpp);
903      eventType = nextNoWhitespace(xpp);
904    }
905    next(xpp);
906    parseElementClose(res);
907    return res;
908  }
909
910  protected boolean parseDataRequirementDateFilterComponentContent(int eventType, XmlPullParser xpp, DataRequirement.DataRequirementDateFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
911    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
912      res.setPathElement(parseString(xpp));
913    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
914      res.setSearchParamElement(parseString(xpp));
915    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
916      res.setValue(parseType("value", xpp));
917    } else if (!parseElementContent(eventType, xpp, res)){ 
918      return false;
919    }
920    return true;
921  }
922
923  protected DataRequirement.DataRequirementValueFilterComponent parseDataRequirementValueFilterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
924    DataRequirement.DataRequirementValueFilterComponent res = new DataRequirement.DataRequirementValueFilterComponent();
925    parseElementAttributes(xpp, res);
926    next(xpp);
927    int eventType = nextNoWhitespace(xpp);
928    while (eventType != XmlPullParser.END_TAG) {
929    if (!parseDataRequirementValueFilterComponentContent(eventType, xpp, res))
930        unknownContent(xpp);
931      eventType = nextNoWhitespace(xpp);
932    }
933    next(xpp);
934    parseElementClose(res);
935    return res;
936  }
937
938  protected boolean parseDataRequirementValueFilterComponentContent(int eventType, XmlPullParser xpp, DataRequirement.DataRequirementValueFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
939    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
940      res.setPathElement(parseString(xpp));
941    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
942      res.setSearchParamElement(parseString(xpp));
943    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comparator")) {
944      res.setComparatorElement(parseEnumeration(xpp, DataRequirement.ValueFilterComparator.NULL, new DataRequirement.ValueFilterComparatorEnumFactory()));
945    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
946      res.setValue(parseType("value", xpp));
947    } else if (!parseElementContent(eventType, xpp, res)){ 
948      return false;
949    }
950    return true;
951  }
952
953  protected DataRequirement.DataRequirementSortComponent parseDataRequirementSortComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
954    DataRequirement.DataRequirementSortComponent res = new DataRequirement.DataRequirementSortComponent();
955    parseElementAttributes(xpp, res);
956    next(xpp);
957    int eventType = nextNoWhitespace(xpp);
958    while (eventType != XmlPullParser.END_TAG) {
959    if (!parseDataRequirementSortComponentContent(eventType, xpp, res))
960        unknownContent(xpp);
961      eventType = nextNoWhitespace(xpp);
962    }
963    next(xpp);
964    parseElementClose(res);
965    return res;
966  }
967
968  protected boolean parseDataRequirementSortComponentContent(int eventType, XmlPullParser xpp, DataRequirement.DataRequirementSortComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
969    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
970      res.setPathElement(parseString(xpp));
971    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("direction")) {
972      res.setDirectionElement(parseEnumeration(xpp, DataRequirement.SortDirection.NULL, new DataRequirement.SortDirectionEnumFactory()));
973    } else if (!parseElementContent(eventType, xpp, res)){ 
974      return false;
975    }
976    return true;
977  }
978
979  protected Distance parseDistance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
980    Distance res = new Distance();
981    parseElementAttributes(xpp, res);
982    next(xpp);
983    int eventType = nextNoWhitespace(xpp);
984    while (eventType != XmlPullParser.END_TAG) {
985    if (!parseDistanceContent(eventType, xpp, res))
986        unknownContent(xpp);
987      eventType = nextNoWhitespace(xpp);
988    }
989    next(xpp);
990    parseElementClose(res);
991    return res;
992  }
993
994  protected boolean parseDistanceContent(int eventType, XmlPullParser xpp, Distance res) throws XmlPullParserException, IOException, FHIRFormatError {
995    if (!parseQuantityContent(eventType, xpp, res)){ 
996      return false;
997    }
998    return true;
999  }
1000
1001  protected Dosage parseDosage(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1002    Dosage res = new Dosage();
1003    parseElementAttributes(xpp, res);
1004    next(xpp);
1005    int eventType = nextNoWhitespace(xpp);
1006    while (eventType != XmlPullParser.END_TAG) {
1007    if (!parseDosageContent(eventType, xpp, res))
1008        unknownContent(xpp);
1009      eventType = nextNoWhitespace(xpp);
1010    }
1011    next(xpp);
1012    parseElementClose(res);
1013    return res;
1014  }
1015
1016  protected boolean parseDosageContent(int eventType, XmlPullParser xpp, Dosage res) throws XmlPullParserException, IOException, FHIRFormatError {
1017    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
1018      res.setSequenceElement(parseInteger(xpp));
1019    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
1020      res.setTextElement(parseString(xpp));
1021    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalInstruction")) {
1022      res.getAdditionalInstruction().add(parseCodeableConcept(xpp));
1023    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientInstruction")) {
1024      res.setPatientInstructionElement(parseString(xpp));
1025    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timing")) {
1026      res.setTiming(parseTiming(xpp));
1027    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("asNeeded")) {
1028      res.setAsNeededElement(parseBoolean(xpp));
1029    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("asNeededFor")) {
1030      res.getAsNeededFor().add(parseCodeableConcept(xpp));
1031    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
1032      res.setSite(parseCodeableConcept(xpp));
1033    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("route")) {
1034      res.setRoute(parseCodeableConcept(xpp));
1035    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
1036      res.setMethod(parseCodeableConcept(xpp));
1037    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doseAndRate")) {
1038      res.getDoseAndRate().add(parseDosageDoseAndRateComponent(xpp));
1039    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerPeriod")) {
1040      res.getMaxDosePerPeriod().add(parseRatio(xpp));
1041    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerAdministration")) {
1042      res.setMaxDosePerAdministration(parseQuantity(xpp));
1043    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerLifetime")) {
1044      res.setMaxDosePerLifetime(parseQuantity(xpp));
1045    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
1046      return false;
1047    }
1048    return true;
1049  }
1050
1051  protected Dosage.DosageDoseAndRateComponent parseDosageDoseAndRateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1052    Dosage.DosageDoseAndRateComponent res = new Dosage.DosageDoseAndRateComponent();
1053    parseElementAttributes(xpp, res);
1054    next(xpp);
1055    int eventType = nextNoWhitespace(xpp);
1056    while (eventType != XmlPullParser.END_TAG) {
1057    if (!parseDosageDoseAndRateComponentContent(eventType, xpp, res))
1058        unknownContent(xpp);
1059      eventType = nextNoWhitespace(xpp);
1060    }
1061    next(xpp);
1062    parseElementClose(res);
1063    return res;
1064  }
1065
1066  protected boolean parseDosageDoseAndRateComponentContent(int eventType, XmlPullParser xpp, Dosage.DosageDoseAndRateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1067    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1068      res.setType(parseCodeableConcept(xpp));
1069    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "dose")) {
1070      res.setDose(parseType("dose", xpp));
1071    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "rate")) {
1072      res.setRate(parseType("rate", xpp));
1073    } else if (!parseElementContent(eventType, xpp, res)){ 
1074      return false;
1075    }
1076    return true;
1077  }
1078
1079  protected Duration parseDuration(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1080    Duration res = new Duration();
1081    parseElementAttributes(xpp, res);
1082    next(xpp);
1083    int eventType = nextNoWhitespace(xpp);
1084    while (eventType != XmlPullParser.END_TAG) {
1085    if (!parseDurationContent(eventType, xpp, res))
1086        unknownContent(xpp);
1087      eventType = nextNoWhitespace(xpp);
1088    }
1089    next(xpp);
1090    parseElementClose(res);
1091    return res;
1092  }
1093
1094  protected boolean parseDurationContent(int eventType, XmlPullParser xpp, Duration res) throws XmlPullParserException, IOException, FHIRFormatError {
1095    if (!parseQuantityContent(eventType, xpp, res)){ 
1096      return false;
1097    }
1098    return true;
1099  }
1100
1101  protected ElementDefinition parseElementDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1102    ElementDefinition res = new ElementDefinition();
1103    parseElementAttributes(xpp, res);
1104    next(xpp);
1105    int eventType = nextNoWhitespace(xpp);
1106    while (eventType != XmlPullParser.END_TAG) {
1107    if (!parseElementDefinitionContent(eventType, xpp, res))
1108        unknownContent(xpp);
1109      eventType = nextNoWhitespace(xpp);
1110    }
1111    next(xpp);
1112    parseElementClose(res);
1113    return res;
1114  }
1115
1116  protected boolean parseElementDefinitionContent(int eventType, XmlPullParser xpp, ElementDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
1117    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
1118      res.setPathElement(parseString(xpp));
1119    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("representation")) {
1120      res.getRepresentation().add(parseEnumeration(xpp, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1121    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sliceName")) {
1122      res.setSliceNameElement(parseString(xpp));
1123    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sliceIsConstraining")) {
1124      res.setSliceIsConstrainingElement(parseBoolean(xpp));
1125    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
1126      res.setLabelElement(parseString(xpp));
1127    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
1128      res.getCode().add(parseCoding(xpp));
1129    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("slicing")) {
1130      res.setSlicing(parseElementDefinitionSlicingComponent(xpp));
1131    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("short")) {
1132      res.setShortElement(parseString(xpp));
1133    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
1134      res.setDefinitionElement(parseMarkdown(xpp));
1135    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
1136      res.setCommentElement(parseMarkdown(xpp));
1137    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requirements")) {
1138      res.setRequirementsElement(parseMarkdown(xpp));
1139    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alias")) {
1140      res.getAlias().add(parseString(xpp));
1141    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
1142      res.setMinElement(parseUnsignedInt(xpp));
1143    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
1144      res.setMaxElement(parseString(xpp));
1145    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("base")) {
1146      res.setBase(parseElementDefinitionBaseComponent(xpp));
1147    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentReference")) {
1148      res.setContentReferenceElement(parseUri(xpp));
1149    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1150      res.getType().add(parseElementDefinitionTypeRefComponent(xpp));
1151    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "defaultValue")) {
1152      res.setDefaultValue(parseType("defaultValue", xpp));
1153    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meaningWhenMissing")) {
1154      res.setMeaningWhenMissingElement(parseMarkdown(xpp));
1155    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderMeaning")) {
1156      res.setOrderMeaningElement(parseString(xpp));
1157    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "fixed")) {
1158      res.setFixed(parseType("fixed", xpp));
1159    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "pattern")) {
1160      res.setPattern(parseType("pattern", xpp));
1161    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("example")) {
1162      res.getExample().add(parseElementDefinitionExampleComponent(xpp));
1163    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "minValue")) {
1164      res.setMinValue(parseType("minValue", xpp));
1165    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "maxValue")) {
1166      res.setMaxValue(parseType("maxValue", xpp));
1167    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxLength")) {
1168      res.setMaxLengthElement(parseInteger(xpp));
1169    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
1170      res.getCondition().add(parseId(xpp));
1171    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("constraint")) {
1172      res.getConstraint().add(parseElementDefinitionConstraintComponent(xpp));
1173    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mustSupport")) {
1174      res.setMustSupportElement(parseBoolean(xpp));
1175    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isModifier")) {
1176      res.setIsModifierElement(parseBoolean(xpp));
1177    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isModifierReason")) {
1178      res.setIsModifierReasonElement(parseString(xpp));
1179    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isSummary")) {
1180      res.setIsSummaryElement(parseBoolean(xpp));
1181    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("binding")) {
1182      res.setBinding(parseElementDefinitionBindingComponent(xpp));
1183    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mapping")) {
1184      res.getMapping().add(parseElementDefinitionMappingComponent(xpp));
1185    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
1186      return false;
1187    }
1188    return true;
1189  }
1190
1191  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionSlicingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1192    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1193    parseElementAttributes(xpp, res);
1194    next(xpp);
1195    int eventType = nextNoWhitespace(xpp);
1196    while (eventType != XmlPullParser.END_TAG) {
1197    if (!parseElementDefinitionSlicingComponentContent(eventType, xpp, res))
1198        unknownContent(xpp);
1199      eventType = nextNoWhitespace(xpp);
1200    }
1201    next(xpp);
1202    parseElementClose(res);
1203    return res;
1204  }
1205
1206  protected boolean parseElementDefinitionSlicingComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionSlicingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1207    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("discriminator")) {
1208      res.getDiscriminator().add(parseElementDefinitionSlicingDiscriminatorComponent(xpp));
1209    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
1210      res.setDescriptionElement(parseString(xpp));
1211    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ordered")) {
1212      res.setOrderedElement(parseBoolean(xpp));
1213    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rules")) {
1214      res.setRulesElement(parseEnumeration(xpp, ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1215    } else if (!parseElementContent(eventType, xpp, res)){ 
1216      return false;
1217    }
1218    return true;
1219  }
1220
1221  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionSlicingDiscriminatorComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1222    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1223    parseElementAttributes(xpp, res);
1224    next(xpp);
1225    int eventType = nextNoWhitespace(xpp);
1226    while (eventType != XmlPullParser.END_TAG) {
1227    if (!parseElementDefinitionSlicingDiscriminatorComponentContent(eventType, xpp, res))
1228        unknownContent(xpp);
1229      eventType = nextNoWhitespace(xpp);
1230    }
1231    next(xpp);
1232    parseElementClose(res);
1233    return res;
1234  }
1235
1236  protected boolean parseElementDefinitionSlicingDiscriminatorComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1237    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1238      res.setTypeElement(parseEnumeration(xpp, ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1239    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
1240      res.setPathElement(parseString(xpp));
1241    } else if (!parseElementContent(eventType, xpp, res)){ 
1242      return false;
1243    }
1244    return true;
1245  }
1246
1247  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionBaseComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1248    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1249    parseElementAttributes(xpp, res);
1250    next(xpp);
1251    int eventType = nextNoWhitespace(xpp);
1252    while (eventType != XmlPullParser.END_TAG) {
1253    if (!parseElementDefinitionBaseComponentContent(eventType, xpp, res))
1254        unknownContent(xpp);
1255      eventType = nextNoWhitespace(xpp);
1256    }
1257    next(xpp);
1258    parseElementClose(res);
1259    return res;
1260  }
1261
1262  protected boolean parseElementDefinitionBaseComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionBaseComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1263    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
1264      res.setPathElement(parseString(xpp));
1265    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
1266      res.setMinElement(parseUnsignedInt(xpp));
1267    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
1268      res.setMaxElement(parseString(xpp));
1269    } else if (!parseElementContent(eventType, xpp, res)){ 
1270      return false;
1271    }
1272    return true;
1273  }
1274
1275  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1276    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1277    parseElementAttributes(xpp, res);
1278    next(xpp);
1279    int eventType = nextNoWhitespace(xpp);
1280    while (eventType != XmlPullParser.END_TAG) {
1281    if (!parseElementDefinitionTypeRefComponentContent(eventType, xpp, res))
1282        unknownContent(xpp);
1283      eventType = nextNoWhitespace(xpp);
1284    }
1285    next(xpp);
1286    parseElementClose(res);
1287    return res;
1288  }
1289
1290  protected boolean parseElementDefinitionTypeRefComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.TypeRefComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1291    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
1292      res.setCodeElement(parseUri(xpp));
1293    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
1294      res.getProfile().add(parseCanonical(xpp));
1295    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetProfile")) {
1296      res.getTargetProfile().add(parseCanonical(xpp));
1297    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("aggregation")) {
1298      res.getAggregation().add(parseEnumeration(xpp, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1299    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versioning")) {
1300      res.setVersioningElement(parseEnumeration(xpp, ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1301    } else if (!parseElementContent(eventType, xpp, res)){ 
1302      return false;
1303    }
1304    return true;
1305  }
1306
1307  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionExampleComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1308    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1309    parseElementAttributes(xpp, res);
1310    next(xpp);
1311    int eventType = nextNoWhitespace(xpp);
1312    while (eventType != XmlPullParser.END_TAG) {
1313    if (!parseElementDefinitionExampleComponentContent(eventType, xpp, res))
1314        unknownContent(xpp);
1315      eventType = nextNoWhitespace(xpp);
1316    }
1317    next(xpp);
1318    parseElementClose(res);
1319    return res;
1320  }
1321
1322  protected boolean parseElementDefinitionExampleComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionExampleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1323    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
1324      res.setLabelElement(parseString(xpp));
1325    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
1326      res.setValue(parseType("value", xpp));
1327    } else if (!parseElementContent(eventType, xpp, res)){ 
1328      return false;
1329    }
1330    return true;
1331  }
1332
1333  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionConstraintComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1334    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1335    parseElementAttributes(xpp, res);
1336    next(xpp);
1337    int eventType = nextNoWhitespace(xpp);
1338    while (eventType != XmlPullParser.END_TAG) {
1339    if (!parseElementDefinitionConstraintComponentContent(eventType, xpp, res))
1340        unknownContent(xpp);
1341      eventType = nextNoWhitespace(xpp);
1342    }
1343    next(xpp);
1344    parseElementClose(res);
1345    return res;
1346  }
1347
1348  protected boolean parseElementDefinitionConstraintComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionConstraintComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1349    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("key")) {
1350      res.setKeyElement(parseId(xpp));
1351    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requirements")) {
1352      res.setRequirementsElement(parseMarkdown(xpp));
1353    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
1354      res.setSeverityElement(parseEnumeration(xpp, ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1355    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suppress")) {
1356      res.setSuppressElement(parseBoolean(xpp));
1357    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("human")) {
1358      res.setHumanElement(parseString(xpp));
1359    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
1360      res.setExpressionElement(parseString(xpp));
1361    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("xpath")) {
1362      res.setXpathElement(parseString(xpp));
1363    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
1364      res.setSourceElement(parseCanonical(xpp));
1365    } else if (!parseElementContent(eventType, xpp, res)){ 
1366      return false;
1367    }
1368    return true;
1369  }
1370
1371  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionBindingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1372    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1373    parseElementAttributes(xpp, res);
1374    next(xpp);
1375    int eventType = nextNoWhitespace(xpp);
1376    while (eventType != XmlPullParser.END_TAG) {
1377    if (!parseElementDefinitionBindingComponentContent(eventType, xpp, res))
1378        unknownContent(xpp);
1379      eventType = nextNoWhitespace(xpp);
1380    }
1381    next(xpp);
1382    parseElementClose(res);
1383    return res;
1384  }
1385
1386  protected boolean parseElementDefinitionBindingComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionBindingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1387    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("strength")) {
1388      res.setStrengthElement(parseEnumeration(xpp, Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1389    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
1390      res.setDescriptionElement(parseMarkdown(xpp));
1391    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
1392      res.setValueSetElement(parseCanonical(xpp));
1393    } else if (!parseElementContent(eventType, xpp, res)){ 
1394      return false;
1395    }
1396    return true;
1397  }
1398
1399  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionMappingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1400    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1401    parseElementAttributes(xpp, res);
1402    next(xpp);
1403    int eventType = nextNoWhitespace(xpp);
1404    while (eventType != XmlPullParser.END_TAG) {
1405    if (!parseElementDefinitionMappingComponentContent(eventType, xpp, res))
1406        unknownContent(xpp);
1407      eventType = nextNoWhitespace(xpp);
1408    }
1409    next(xpp);
1410    parseElementClose(res);
1411    return res;
1412  }
1413
1414  protected boolean parseElementDefinitionMappingComponentContent(int eventType, XmlPullParser xpp, ElementDefinition.ElementDefinitionMappingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1415    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identity")) {
1416      res.setIdentityElement(parseId(xpp));
1417    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
1418      res.setLanguageElement(parseCode(xpp));
1419    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("map")) {
1420      res.setMapElement(parseString(xpp));
1421    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
1422      res.setCommentElement(parseMarkdown(xpp));
1423    } else if (!parseElementContent(eventType, xpp, res)){ 
1424      return false;
1425    }
1426    return true;
1427  }
1428
1429  protected Expression parseExpression(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1430    Expression res = new Expression();
1431    parseElementAttributes(xpp, res);
1432    next(xpp);
1433    int eventType = nextNoWhitespace(xpp);
1434    while (eventType != XmlPullParser.END_TAG) {
1435    if (!parseExpressionContent(eventType, xpp, res))
1436        unknownContent(xpp);
1437      eventType = nextNoWhitespace(xpp);
1438    }
1439    next(xpp);
1440    parseElementClose(res);
1441    return res;
1442  }
1443
1444  protected boolean parseExpressionContent(int eventType, XmlPullParser xpp, Expression res) throws XmlPullParserException, IOException, FHIRFormatError {
1445    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
1446      res.setDescriptionElement(parseString(xpp));
1447    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
1448      res.setNameElement(parseId(xpp));
1449    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
1450      res.setLanguageElement(parseCode(xpp));
1451    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
1452      res.setExpressionElement(parseString(xpp));
1453    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
1454      res.setReferenceElement(parseUri(xpp));
1455    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1456      return false;
1457    }
1458    return true;
1459  }
1460
1461  protected ExtendedContactDetail parseExtendedContactDetail(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1462    ExtendedContactDetail res = new ExtendedContactDetail();
1463    parseElementAttributes(xpp, res);
1464    next(xpp);
1465    int eventType = nextNoWhitespace(xpp);
1466    while (eventType != XmlPullParser.END_TAG) {
1467    if (!parseExtendedContactDetailContent(eventType, xpp, res))
1468        unknownContent(xpp);
1469      eventType = nextNoWhitespace(xpp);
1470    }
1471    next(xpp);
1472    parseElementClose(res);
1473    return res;
1474  }
1475
1476  protected boolean parseExtendedContactDetailContent(int eventType, XmlPullParser xpp, ExtendedContactDetail res) throws XmlPullParserException, IOException, FHIRFormatError {
1477    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
1478      res.setPurpose(parseCodeableConcept(xpp));
1479    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
1480      res.getName().add(parseHumanName(xpp));
1481    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
1482      res.getTelecom().add(parseContactPoint(xpp));
1483    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
1484      res.setAddress(parseAddress(xpp));
1485    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("organization")) {
1486      res.setOrganization(parseReference(xpp));
1487    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
1488      res.setPeriod(parsePeriod(xpp));
1489    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1490      return false;
1491    }
1492    return true;
1493  }
1494
1495  protected Extension parseExtension(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1496    Extension res = new Extension();
1497    parseElementAttributes(xpp, res);
1498    if (xpp.getAttributeValue(null, "url") != null)
1499        res.setUrl(xpp.getAttributeValue(null, "url"));
1500    next(xpp);
1501    int eventType = nextNoWhitespace(xpp);
1502    while (eventType != XmlPullParser.END_TAG) {
1503    if (!parseExtensionContent(eventType, xpp, res))
1504        unknownContent(xpp);
1505      eventType = nextNoWhitespace(xpp);
1506    }
1507    next(xpp);
1508    parseElementClose(res);
1509    return res;
1510  }
1511
1512  protected boolean parseExtensionContent(int eventType, XmlPullParser xpp, Extension res) throws XmlPullParserException, IOException, FHIRFormatError {
1513    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
1514      res.setValue(parseType("value", xpp));
1515    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1516      return false;
1517    }
1518    return true;
1519  }
1520
1521  protected HumanName parseHumanName(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1522    HumanName res = new HumanName();
1523    parseElementAttributes(xpp, res);
1524    next(xpp);
1525    int eventType = nextNoWhitespace(xpp);
1526    while (eventType != XmlPullParser.END_TAG) {
1527    if (!parseHumanNameContent(eventType, xpp, res))
1528        unknownContent(xpp);
1529      eventType = nextNoWhitespace(xpp);
1530    }
1531    next(xpp);
1532    parseElementClose(res);
1533    return res;
1534  }
1535
1536  protected boolean parseHumanNameContent(int eventType, XmlPullParser xpp, HumanName res) throws XmlPullParserException, IOException, FHIRFormatError {
1537    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
1538      res.setUseElement(parseEnumeration(xpp, HumanName.NameUse.NULL, new HumanName.NameUseEnumFactory()));
1539    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
1540      res.setTextElement(parseString(xpp));
1541    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("family")) {
1542      res.setFamilyElement(parseString(xpp));
1543    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("given")) {
1544      res.getGiven().add(parseString(xpp));
1545    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prefix")) {
1546      res.getPrefix().add(parseString(xpp));
1547    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suffix")) {
1548      res.getSuffix().add(parseString(xpp));
1549    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
1550      res.setPeriod(parsePeriod(xpp));
1551    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1552      return false;
1553    }
1554    return true;
1555  }
1556
1557  protected Identifier parseIdentifier(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1558    Identifier res = new Identifier();
1559    parseElementAttributes(xpp, res);
1560    next(xpp);
1561    int eventType = nextNoWhitespace(xpp);
1562    while (eventType != XmlPullParser.END_TAG) {
1563    if (!parseIdentifierContent(eventType, xpp, res))
1564        unknownContent(xpp);
1565      eventType = nextNoWhitespace(xpp);
1566    }
1567    next(xpp);
1568    parseElementClose(res);
1569    return res;
1570  }
1571
1572  protected boolean parseIdentifierContent(int eventType, XmlPullParser xpp, Identifier res) throws XmlPullParserException, IOException, FHIRFormatError {
1573    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
1574      res.setUseElement(parseEnumeration(xpp, Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
1575    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1576      res.setType(parseCodeableConcept(xpp));
1577    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
1578      res.setSystemElement(parseUri(xpp));
1579    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1580      res.setValueElement(parseString(xpp));
1581    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
1582      res.setPeriod(parsePeriod(xpp));
1583    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assigner")) {
1584      res.setAssigner(parseReference(xpp));
1585    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1586      return false;
1587    }
1588    return true;
1589  }
1590
1591  protected MarketingStatus parseMarketingStatus(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1592    MarketingStatus res = new MarketingStatus();
1593    parseElementAttributes(xpp, res);
1594    next(xpp);
1595    int eventType = nextNoWhitespace(xpp);
1596    while (eventType != XmlPullParser.END_TAG) {
1597    if (!parseMarketingStatusContent(eventType, xpp, res))
1598        unknownContent(xpp);
1599      eventType = nextNoWhitespace(xpp);
1600    }
1601    next(xpp);
1602    parseElementClose(res);
1603    return res;
1604  }
1605
1606  protected boolean parseMarketingStatusContent(int eventType, XmlPullParser xpp, MarketingStatus res) throws XmlPullParserException, IOException, FHIRFormatError {
1607    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("country")) {
1608      res.setCountry(parseCodeableConcept(xpp));
1609    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
1610      res.setJurisdiction(parseCodeableConcept(xpp));
1611    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
1612      res.setStatus(parseCodeableConcept(xpp));
1613    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateRange")) {
1614      res.setDateRange(parsePeriod(xpp));
1615    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("restoreDate")) {
1616      res.setRestoreDateElement(parseDateTime(xpp));
1617    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
1618      return false;
1619    }
1620    return true;
1621  }
1622
1623  protected Meta parseMeta(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1624    Meta res = new Meta();
1625    parseElementAttributes(xpp, res);
1626    next(xpp);
1627    int eventType = nextNoWhitespace(xpp);
1628    while (eventType != XmlPullParser.END_TAG) {
1629    if (!parseMetaContent(eventType, xpp, res))
1630        unknownContent(xpp);
1631      eventType = nextNoWhitespace(xpp);
1632    }
1633    next(xpp);
1634    parseElementClose(res);
1635    return res;
1636  }
1637
1638  protected boolean parseMetaContent(int eventType, XmlPullParser xpp, Meta res) throws XmlPullParserException, IOException, FHIRFormatError {
1639    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versionId")) {
1640      res.setVersionIdElement(parseId(xpp));
1641    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastUpdated")) {
1642      res.setLastUpdatedElement(parseInstant(xpp));
1643    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
1644      res.setSourceElement(parseUri(xpp));
1645    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
1646      res.getProfile().add(parseCanonical(xpp));
1647    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("security")) {
1648      res.getSecurity().add(parseCoding(xpp));
1649    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tag")) {
1650      res.getTag().add(parseCoding(xpp));
1651    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1652      return false;
1653    }
1654    return true;
1655  }
1656
1657  protected MonetaryComponent parseMonetaryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1658    MonetaryComponent res = new MonetaryComponent();
1659    parseElementAttributes(xpp, res);
1660    next(xpp);
1661    int eventType = nextNoWhitespace(xpp);
1662    while (eventType != XmlPullParser.END_TAG) {
1663    if (!parseMonetaryComponentContent(eventType, xpp, res))
1664        unknownContent(xpp);
1665      eventType = nextNoWhitespace(xpp);
1666    }
1667    next(xpp);
1668    parseElementClose(res);
1669    return res;
1670  }
1671
1672  protected boolean parseMonetaryComponentContent(int eventType, XmlPullParser xpp, MonetaryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
1673    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1674      res.setTypeElement(parseEnumeration(xpp, MonetaryComponent.PriceComponentType.NULL, new MonetaryComponent.PriceComponentTypeEnumFactory()));
1675    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
1676      res.setCode(parseCodeableConcept(xpp));
1677    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
1678      res.setFactorElement(parseDecimal(xpp));
1679    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
1680      res.setAmount(parseMoney(xpp));
1681    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1682      return false;
1683    }
1684    return true;
1685  }
1686
1687  protected Money parseMoney(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1688    Money res = new Money();
1689    parseElementAttributes(xpp, res);
1690    next(xpp);
1691    int eventType = nextNoWhitespace(xpp);
1692    while (eventType != XmlPullParser.END_TAG) {
1693    if (!parseMoneyContent(eventType, xpp, res))
1694        unknownContent(xpp);
1695      eventType = nextNoWhitespace(xpp);
1696    }
1697    next(xpp);
1698    parseElementClose(res);
1699    return res;
1700  }
1701
1702  protected boolean parseMoneyContent(int eventType, XmlPullParser xpp, Money res) throws XmlPullParserException, IOException, FHIRFormatError {
1703    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1704      res.setValueElement(parseDecimal(xpp));
1705    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("currency")) {
1706      res.setCurrencyElement(parseCode(xpp));
1707    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1708      return false;
1709    }
1710    return true;
1711  }
1712
1713  protected Narrative parseNarrative(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1714    Narrative res = new Narrative();
1715    parseElementAttributes(xpp, res);
1716    next(xpp);
1717    int eventType = nextNoWhitespace(xpp);
1718    while (eventType != XmlPullParser.END_TAG) {
1719    if (!parseNarrativeContent(eventType, xpp, res))
1720        unknownContent(xpp);
1721      eventType = nextNoWhitespace(xpp);
1722    }
1723    next(xpp);
1724    parseElementClose(res);
1725    return res;
1726  }
1727
1728  protected boolean parseNarrativeContent(int eventType, XmlPullParser xpp, Narrative res) throws XmlPullParserException, IOException, FHIRFormatError {
1729    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
1730      res.setStatusElement(parseEnumeration(xpp, Narrative.NarrativeStatus.NULL, new Narrative.NarrativeStatusEnumFactory()));
1731    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("div")) {
1732      res.setDiv(parseXhtml(xpp));
1733    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1734      return false;
1735    }
1736    return true;
1737  }
1738
1739  protected ParameterDefinition parseParameterDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1740    ParameterDefinition res = new ParameterDefinition();
1741    parseElementAttributes(xpp, res);
1742    next(xpp);
1743    int eventType = nextNoWhitespace(xpp);
1744    while (eventType != XmlPullParser.END_TAG) {
1745    if (!parseParameterDefinitionContent(eventType, xpp, res))
1746        unknownContent(xpp);
1747      eventType = nextNoWhitespace(xpp);
1748    }
1749    next(xpp);
1750    parseElementClose(res);
1751    return res;
1752  }
1753
1754  protected boolean parseParameterDefinitionContent(int eventType, XmlPullParser xpp, ParameterDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
1755    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
1756      res.setNameElement(parseCode(xpp));
1757    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
1758      res.setUseElement(parseEnumeration(xpp, Enumerations.OperationParameterUse.NULL, new Enumerations.OperationParameterUseEnumFactory()));
1759    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
1760      res.setMinElement(parseInteger(xpp));
1761    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
1762      res.setMaxElement(parseString(xpp));
1763    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
1764      res.setDocumentationElement(parseString(xpp));
1765    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1766      res.setTypeElement(parseEnumeration(xpp, Enumerations.FHIRTypes.NULL, new Enumerations.FHIRTypesEnumFactory()));
1767    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
1768      res.setProfileElement(parseCanonical(xpp));
1769    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1770      return false;
1771    }
1772    return true;
1773  }
1774
1775  protected Period parsePeriod(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1776    Period res = new Period();
1777    parseElementAttributes(xpp, res);
1778    next(xpp);
1779    int eventType = nextNoWhitespace(xpp);
1780    while (eventType != XmlPullParser.END_TAG) {
1781    if (!parsePeriodContent(eventType, xpp, res))
1782        unknownContent(xpp);
1783      eventType = nextNoWhitespace(xpp);
1784    }
1785    next(xpp);
1786    parseElementClose(res);
1787    return res;
1788  }
1789
1790  protected boolean parsePeriodContent(int eventType, XmlPullParser xpp, Period res) throws XmlPullParserException, IOException, FHIRFormatError {
1791    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
1792      res.setStartElement(parseDateTime(xpp));
1793    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
1794      res.setEndElement(parseDateTime(xpp));
1795    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1796      return false;
1797    }
1798    return true;
1799  }
1800
1801  protected Population parsePopulation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1802    Population res = new Population();
1803    parseElementAttributes(xpp, res);
1804    next(xpp);
1805    int eventType = nextNoWhitespace(xpp);
1806    while (eventType != XmlPullParser.END_TAG) {
1807    if (!parsePopulationContent(eventType, xpp, res))
1808        unknownContent(xpp);
1809      eventType = nextNoWhitespace(xpp);
1810    }
1811    next(xpp);
1812    parseElementClose(res);
1813    return res;
1814  }
1815
1816  protected boolean parsePopulationContent(int eventType, XmlPullParser xpp, Population res) throws XmlPullParserException, IOException, FHIRFormatError {
1817    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "age")) {
1818      res.setAge(parseType("age", xpp));
1819    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("gender")) {
1820      res.setGender(parseCodeableConcept(xpp));
1821    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("race")) {
1822      res.setRace(parseCodeableConcept(xpp));
1823    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("physiologicalCondition")) {
1824      res.setPhysiologicalCondition(parseCodeableConcept(xpp));
1825    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
1826      return false;
1827    }
1828    return true;
1829  }
1830
1831  protected ProductShelfLife parseProductShelfLife(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1832    ProductShelfLife res = new ProductShelfLife();
1833    parseElementAttributes(xpp, res);
1834    next(xpp);
1835    int eventType = nextNoWhitespace(xpp);
1836    while (eventType != XmlPullParser.END_TAG) {
1837    if (!parseProductShelfLifeContent(eventType, xpp, res))
1838        unknownContent(xpp);
1839      eventType = nextNoWhitespace(xpp);
1840    }
1841    next(xpp);
1842    parseElementClose(res);
1843    return res;
1844  }
1845
1846  protected boolean parseProductShelfLifeContent(int eventType, XmlPullParser xpp, ProductShelfLife res) throws XmlPullParserException, IOException, FHIRFormatError {
1847    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1848      res.setType(parseCodeableConcept(xpp));
1849    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "period")) {
1850      res.setPeriod(parseType("period", xpp));
1851    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialPrecautionsForStorage")) {
1852      res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(xpp));
1853    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
1854      return false;
1855    }
1856    return true;
1857  }
1858
1859  protected Quantity parseQuantity(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1860    Quantity res = new Quantity();
1861    parseElementAttributes(xpp, res);
1862    next(xpp);
1863    int eventType = nextNoWhitespace(xpp);
1864    while (eventType != XmlPullParser.END_TAG) {
1865    if (!parseQuantityContent(eventType, xpp, res))
1866        unknownContent(xpp);
1867      eventType = nextNoWhitespace(xpp);
1868    }
1869    next(xpp);
1870    parseElementClose(res);
1871    return res;
1872  }
1873
1874  protected boolean parseQuantityContent(int eventType, XmlPullParser xpp, Quantity res) throws XmlPullParserException, IOException, FHIRFormatError {
1875    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1876      res.setValueElement(parseDecimal(xpp));
1877    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comparator")) {
1878      res.setComparatorElement(parseEnumeration(xpp, Enumerations.QuantityComparator.NULL, new Enumerations.QuantityComparatorEnumFactory()));
1879    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unit")) {
1880      res.setUnitElement(parseString(xpp));
1881    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system")) {
1882      res.setSystemElement(parseUri(xpp));
1883    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
1884      res.setCodeElement(parseCode(xpp));
1885    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1886      return false;
1887    }
1888    return true;
1889  }
1890
1891  protected Range parseRange(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1892    Range res = new Range();
1893    parseElementAttributes(xpp, res);
1894    next(xpp);
1895    int eventType = nextNoWhitespace(xpp);
1896    while (eventType != XmlPullParser.END_TAG) {
1897    if (!parseRangeContent(eventType, xpp, res))
1898        unknownContent(xpp);
1899      eventType = nextNoWhitespace(xpp);
1900    }
1901    next(xpp);
1902    parseElementClose(res);
1903    return res;
1904  }
1905
1906  protected boolean parseRangeContent(int eventType, XmlPullParser xpp, Range res) throws XmlPullParserException, IOException, FHIRFormatError {
1907    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("low")) {
1908      res.setLow(parseQuantity(xpp));
1909    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("high")) {
1910      res.setHigh(parseQuantity(xpp));
1911    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1912      return false;
1913    }
1914    return true;
1915  }
1916
1917  protected Ratio parseRatio(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1918    Ratio res = new Ratio();
1919    parseElementAttributes(xpp, res);
1920    next(xpp);
1921    int eventType = nextNoWhitespace(xpp);
1922    while (eventType != XmlPullParser.END_TAG) {
1923    if (!parseRatioContent(eventType, xpp, res))
1924        unknownContent(xpp);
1925      eventType = nextNoWhitespace(xpp);
1926    }
1927    next(xpp);
1928    parseElementClose(res);
1929    return res;
1930  }
1931
1932  protected boolean parseRatioContent(int eventType, XmlPullParser xpp, Ratio res) throws XmlPullParserException, IOException, FHIRFormatError {
1933    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numerator")) {
1934      res.setNumerator(parseQuantity(xpp));
1935    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("denominator")) {
1936      res.setDenominator(parseQuantity(xpp));
1937    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1938      return false;
1939    }
1940    return true;
1941  }
1942
1943  protected RatioRange parseRatioRange(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1944    RatioRange res = new RatioRange();
1945    parseElementAttributes(xpp, res);
1946    next(xpp);
1947    int eventType = nextNoWhitespace(xpp);
1948    while (eventType != XmlPullParser.END_TAG) {
1949    if (!parseRatioRangeContent(eventType, xpp, res))
1950        unknownContent(xpp);
1951      eventType = nextNoWhitespace(xpp);
1952    }
1953    next(xpp);
1954    parseElementClose(res);
1955    return res;
1956  }
1957
1958  protected boolean parseRatioRangeContent(int eventType, XmlPullParser xpp, RatioRange res) throws XmlPullParserException, IOException, FHIRFormatError {
1959    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lowNumerator")) {
1960      res.setLowNumerator(parseQuantity(xpp));
1961    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("highNumerator")) {
1962      res.setHighNumerator(parseQuantity(xpp));
1963    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("denominator")) {
1964      res.setDenominator(parseQuantity(xpp));
1965    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1966      return false;
1967    }
1968    return true;
1969  }
1970
1971  protected Reference parseReference(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1972    Reference res = new Reference();
1973    parseElementAttributes(xpp, res);
1974    next(xpp);
1975    int eventType = nextNoWhitespace(xpp);
1976    while (eventType != XmlPullParser.END_TAG) {
1977    if (!parseReferenceContent(eventType, xpp, res))
1978        unknownContent(xpp);
1979      eventType = nextNoWhitespace(xpp);
1980    }
1981    next(xpp);
1982    parseElementClose(res);
1983    return res;
1984  }
1985
1986  protected boolean parseReferenceContent(int eventType, XmlPullParser xpp, Reference res) throws XmlPullParserException, IOException, FHIRFormatError {
1987    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
1988      res.setReferenceElement(parseString(xpp));
1989    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1990      res.setTypeElement(parseUri(xpp));
1991    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
1992      res.setIdentifier(parseIdentifier(xpp));
1993    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
1994      res.setDisplayElement(parseString(xpp));
1995    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
1996      return false;
1997    }
1998    return true;
1999  }
2000
2001  protected RelatedArtifact parseRelatedArtifact(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2002    RelatedArtifact res = new RelatedArtifact();
2003    parseElementAttributes(xpp, res);
2004    next(xpp);
2005    int eventType = nextNoWhitespace(xpp);
2006    while (eventType != XmlPullParser.END_TAG) {
2007    if (!parseRelatedArtifactContent(eventType, xpp, res))
2008        unknownContent(xpp);
2009      eventType = nextNoWhitespace(xpp);
2010    }
2011    next(xpp);
2012    parseElementClose(res);
2013    return res;
2014  }
2015
2016  protected boolean parseRelatedArtifactContent(int eventType, XmlPullParser xpp, RelatedArtifact res) throws XmlPullParserException, IOException, FHIRFormatError {
2017    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2018      res.setTypeElement(parseEnumeration(xpp, RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
2019    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classifier")) {
2020      res.getClassifier().add(parseCodeableConcept(xpp));
2021    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
2022      res.setLabelElement(parseString(xpp));
2023    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
2024      res.setDisplayElement(parseString(xpp));
2025    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citation")) {
2026      res.setCitationElement(parseMarkdown(xpp));
2027    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("document")) {
2028      res.setDocument(parseAttachment(xpp));
2029    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
2030      res.setResourceElement(parseCanonical(xpp));
2031    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceReference")) {
2032      res.setResourceReference(parseReference(xpp));
2033    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationStatus")) {
2034      res.setPublicationStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2035    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDate")) {
2036      res.setPublicationDateElement(parseDate(xpp));
2037    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
2038      return false;
2039    }
2040    return true;
2041  }
2042
2043  protected SampledData parseSampledData(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2044    SampledData res = new SampledData();
2045    parseElementAttributes(xpp, res);
2046    next(xpp);
2047    int eventType = nextNoWhitespace(xpp);
2048    while (eventType != XmlPullParser.END_TAG) {
2049    if (!parseSampledDataContent(eventType, xpp, res))
2050        unknownContent(xpp);
2051      eventType = nextNoWhitespace(xpp);
2052    }
2053    next(xpp);
2054    parseElementClose(res);
2055    return res;
2056  }
2057
2058  protected boolean parseSampledDataContent(int eventType, XmlPullParser xpp, SampledData res) throws XmlPullParserException, IOException, FHIRFormatError {
2059    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("origin")) {
2060      res.setOrigin(parseQuantity(xpp));
2061    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interval")) {
2062      res.setIntervalElement(parseDecimal(xpp));
2063    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intervalUnit")) {
2064      res.setIntervalUnitElement(parseCode(xpp));
2065    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
2066      res.setFactorElement(parseDecimal(xpp));
2067    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lowerLimit")) {
2068      res.setLowerLimitElement(parseDecimal(xpp));
2069    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("upperLimit")) {
2070      res.setUpperLimitElement(parseDecimal(xpp));
2071    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dimensions")) {
2072      res.setDimensionsElement(parsePositiveInt(xpp));
2073    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
2074      res.setDataElement(parseString(xpp));
2075    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
2076      return false;
2077    }
2078    return true;
2079  }
2080
2081  protected Signature parseSignature(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2082    Signature res = new Signature();
2083    parseElementAttributes(xpp, res);
2084    next(xpp);
2085    int eventType = nextNoWhitespace(xpp);
2086    while (eventType != XmlPullParser.END_TAG) {
2087    if (!parseSignatureContent(eventType, xpp, res))
2088        unknownContent(xpp);
2089      eventType = nextNoWhitespace(xpp);
2090    }
2091    next(xpp);
2092    parseElementClose(res);
2093    return res;
2094  }
2095
2096  protected boolean parseSignatureContent(int eventType, XmlPullParser xpp, Signature res) throws XmlPullParserException, IOException, FHIRFormatError {
2097    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2098      res.getType().add(parseCoding(xpp));
2099    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("when")) {
2100      res.setWhenElement(parseInstant(xpp));
2101    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("who")) {
2102      res.setWho(parseReference(xpp));
2103    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
2104      res.setOnBehalfOf(parseReference(xpp));
2105    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetFormat")) {
2106      res.setTargetFormatElement(parseCode(xpp));
2107    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sigFormat")) {
2108      res.setSigFormatElement(parseCode(xpp));
2109    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
2110      res.setDataElement(parseBase64Binary(xpp));
2111    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
2112      return false;
2113    }
2114    return true;
2115  }
2116
2117  protected Timing parseTiming(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2118    Timing res = new Timing();
2119    parseElementAttributes(xpp, res);
2120    next(xpp);
2121    int eventType = nextNoWhitespace(xpp);
2122    while (eventType != XmlPullParser.END_TAG) {
2123    if (!parseTimingContent(eventType, xpp, res))
2124        unknownContent(xpp);
2125      eventType = nextNoWhitespace(xpp);
2126    }
2127    next(xpp);
2128    parseElementClose(res);
2129    return res;
2130  }
2131
2132  protected boolean parseTimingContent(int eventType, XmlPullParser xpp, Timing res) throws XmlPullParserException, IOException, FHIRFormatError {
2133    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
2134      res.getEvent().add(parseDateTime(xpp));
2135    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("repeat")) {
2136      res.setRepeat(parseTimingRepeatComponent(xpp));
2137    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
2138      res.setCode(parseCodeableConcept(xpp));
2139    } else if (!parseBackboneTypeContent(eventType, xpp, res)){ 
2140      return false;
2141    }
2142    return true;
2143  }
2144
2145  protected Timing.TimingRepeatComponent parseTimingRepeatComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2146    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
2147    parseElementAttributes(xpp, res);
2148    next(xpp);
2149    int eventType = nextNoWhitespace(xpp);
2150    while (eventType != XmlPullParser.END_TAG) {
2151    if (!parseTimingRepeatComponentContent(eventType, xpp, res))
2152        unknownContent(xpp);
2153      eventType = nextNoWhitespace(xpp);
2154    }
2155    next(xpp);
2156    parseElementClose(res);
2157    return res;
2158  }
2159
2160  protected boolean parseTimingRepeatComponentContent(int eventType, XmlPullParser xpp, Timing.TimingRepeatComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2161    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "bounds")) {
2162      res.setBounds(parseType("bounds", xpp));
2163    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("count")) {
2164      res.setCountElement(parsePositiveInt(xpp));
2165    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("countMax")) {
2166      res.setCountMaxElement(parsePositiveInt(xpp));
2167    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
2168      res.setDurationElement(parseDecimal(xpp));
2169    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("durationMax")) {
2170      res.setDurationMaxElement(parseDecimal(xpp));
2171    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("durationUnit")) {
2172      res.setDurationUnitElement(parseEnumeration(xpp, Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2173    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequency")) {
2174      res.setFrequencyElement(parsePositiveInt(xpp));
2175    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequencyMax")) {
2176      res.setFrequencyMaxElement(parsePositiveInt(xpp));
2177    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
2178      res.setPeriodElement(parseDecimal(xpp));
2179    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("periodMax")) {
2180      res.setPeriodMaxElement(parseDecimal(xpp));
2181    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("periodUnit")) {
2182      res.setPeriodUnitElement(parseEnumeration(xpp, Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
2183    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dayOfWeek")) {
2184      res.getDayOfWeek().add(parseEnumeration(xpp, Enumerations.DaysOfWeek.NULL, new Enumerations.DaysOfWeekEnumFactory()));
2185    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timeOfDay")) {
2186      res.getTimeOfDay().add(parseTime(xpp));
2187    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("when")) {
2188      res.getWhen().add(parseEnumeration(xpp, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
2189    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("offset")) {
2190      res.setOffsetElement(parseUnsignedInt(xpp));
2191    } else if (!parseElementContent(eventType, xpp, res)){ 
2192      return false;
2193    }
2194    return true;
2195  }
2196
2197  protected TriggerDefinition parseTriggerDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2198    TriggerDefinition res = new TriggerDefinition();
2199    parseElementAttributes(xpp, res);
2200    next(xpp);
2201    int eventType = nextNoWhitespace(xpp);
2202    while (eventType != XmlPullParser.END_TAG) {
2203    if (!parseTriggerDefinitionContent(eventType, xpp, res))
2204        unknownContent(xpp);
2205      eventType = nextNoWhitespace(xpp);
2206    }
2207    next(xpp);
2208    parseElementClose(res);
2209    return res;
2210  }
2211
2212  protected boolean parseTriggerDefinitionContent(int eventType, XmlPullParser xpp, TriggerDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
2213    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2214      res.setTypeElement(parseEnumeration(xpp, TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
2215    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
2216      res.setNameElement(parseString(xpp));
2217    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
2218      res.setCode(parseCodeableConcept(xpp));
2219    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subscriptionTopic")) {
2220      res.setSubscriptionTopicElement(parseCanonical(xpp));
2221    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
2222      res.setTiming(parseType("timing", xpp));
2223    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
2224      res.getData().add(parseDataRequirement(xpp));
2225    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
2226      res.setCondition(parseExpression(xpp));
2227    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
2228      return false;
2229    }
2230    return true;
2231  }
2232
2233  protected UsageContext parseUsageContext(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2234    UsageContext res = new UsageContext();
2235    parseElementAttributes(xpp, res);
2236    next(xpp);
2237    int eventType = nextNoWhitespace(xpp);
2238    while (eventType != XmlPullParser.END_TAG) {
2239    if (!parseUsageContextContent(eventType, xpp, res))
2240        unknownContent(xpp);
2241      eventType = nextNoWhitespace(xpp);
2242    }
2243    next(xpp);
2244    parseElementClose(res);
2245    return res;
2246  }
2247
2248  protected boolean parseUsageContextContent(int eventType, XmlPullParser xpp, UsageContext res) throws XmlPullParserException, IOException, FHIRFormatError {
2249    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
2250      res.setCode(parseCoding(xpp));
2251    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
2252      res.setValue(parseType("value", xpp));
2253    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
2254      return false;
2255    }
2256    return true;
2257  }
2258
2259  protected VirtualServiceDetail parseVirtualServiceDetail(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2260    VirtualServiceDetail res = new VirtualServiceDetail();
2261    parseElementAttributes(xpp, res);
2262    next(xpp);
2263    int eventType = nextNoWhitespace(xpp);
2264    while (eventType != XmlPullParser.END_TAG) {
2265    if (!parseVirtualServiceDetailContent(eventType, xpp, res))
2266        unknownContent(xpp);
2267      eventType = nextNoWhitespace(xpp);
2268    }
2269    next(xpp);
2270    parseElementClose(res);
2271    return res;
2272  }
2273
2274  protected boolean parseVirtualServiceDetailContent(int eventType, XmlPullParser xpp, VirtualServiceDetail res) throws XmlPullParserException, IOException, FHIRFormatError {
2275    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("channelType")) {
2276      res.setChannelType(parseCoding(xpp));
2277    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "address")) {
2278      res.setAddress(parseType("address", xpp));
2279    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalInfo")) {
2280      res.getAdditionalInfo().add(parseUrl(xpp));
2281    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxParticipants")) {
2282      res.setMaxParticipantsElement(parsePositiveInt(xpp));
2283    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sessionKey")) {
2284      res.setSessionKeyElement(parseString(xpp));
2285    } else if (!parseDataTypeContent(eventType, xpp, res)){ 
2286      return false;
2287    }
2288    return true;
2289  }
2290
2291  protected boolean parseCanonicalResourceContent(int eventType, XmlPullParser xpp, CanonicalResource res) throws XmlPullParserException, IOException, FHIRFormatError {
2292    if (!parseDomainResourceContent(eventType, xpp, res)){ 
2293        return false;
2294    }
2295    return true;
2296  }
2297
2298  protected boolean parseDomainResourceContent(int eventType, XmlPullParser xpp, DomainResource res) throws XmlPullParserException, IOException, FHIRFormatError {
2299    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
2300      res.setText(parseNarrative(xpp));
2301    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contained")) {
2302      res.getContained().add(parseResourceContained(xpp));
2303    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extension")) {
2304      res.getExtension().add(parseExtension(xpp));
2305    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifierExtension")) {
2306      res.getModifierExtension().add(parseExtension(xpp));
2307    } else if (!parseResourceContent(eventType, xpp, res)){ 
2308        return false;
2309    }
2310    return true;
2311  }
2312
2313  protected boolean parseMetadataResourceContent(int eventType, XmlPullParser xpp, MetadataResource res) throws XmlPullParserException, IOException, FHIRFormatError {
2314    if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
2315        return false;
2316    }
2317    return true;
2318  }
2319
2320  protected boolean parseResourceContent(int eventType, XmlPullParser xpp, Resource res) throws XmlPullParserException, IOException, FHIRFormatError {
2321    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("id")) {
2322      res.setIdElement(parseId(xpp));
2323    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meta")) {
2324      res.setMeta(parseMeta(xpp));
2325    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implicitRules")) {
2326      res.setImplicitRulesElement(parseUri(xpp));
2327    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
2328      res.setLanguageElement(parseCode(xpp));
2329    } else if (!parseBaseContent(eventType, xpp, res)){ 
2330        return false;
2331    }
2332    return true;
2333  }
2334
2335  protected Account parseAccount(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2336    Account res = new Account();
2337    parseResourceAttributes(xpp, res);
2338    next(xpp);
2339    int eventType = nextNoWhitespace(xpp);
2340    while (eventType != XmlPullParser.END_TAG) {
2341    if (!parseAccountContent(eventType, xpp, res))
2342        unknownContent(xpp);
2343      eventType = nextNoWhitespace(xpp);
2344    }
2345    next(xpp);
2346    parseElementClose(res);
2347    return res;
2348  }
2349
2350  protected boolean parseAccountContent(int eventType, XmlPullParser xpp, Account res) throws XmlPullParserException, IOException, FHIRFormatError {
2351    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
2352      res.getIdentifier().add(parseIdentifier(xpp));
2353    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
2354      res.setStatusElement(parseEnumeration(xpp, Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2355    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("billingStatus")) {
2356      res.setBillingStatus(parseCodeableConcept(xpp));
2357    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2358      res.setType(parseCodeableConcept(xpp));
2359    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
2360      res.setNameElement(parseString(xpp));
2361    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
2362      res.getSubject().add(parseReference(xpp));
2363    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("servicePeriod")) {
2364      res.setServicePeriod(parsePeriod(xpp));
2365    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
2366      res.getCoverage().add(parseAccountCoverageComponent(xpp));
2367    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("owner")) {
2368      res.setOwner(parseReference(xpp));
2369    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
2370      res.setDescriptionElement(parseString(xpp));
2371    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("guarantor")) {
2372      res.getGuarantor().add(parseAccountGuarantorComponent(xpp));
2373    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedAccount")) {
2374      res.getRelatedAccount().add(parseAccountRelatedAccountComponent(xpp));
2375    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("currency")) {
2376      res.setCurrency(parseCodeableConcept(xpp));
2377    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("balance")) {
2378      res.getBalance().add(parseAccountBalanceComponent(xpp));
2379    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("calculatedAt")) {
2380      res.setCalculatedAtElement(parseInstant(xpp));
2381    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
2382      return false;
2383    }
2384    return true;
2385  }
2386
2387  protected Account.CoverageComponent parseAccountCoverageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2388    Account.CoverageComponent res = new Account.CoverageComponent();
2389    parseElementAttributes(xpp, res);
2390    next(xpp);
2391    int eventType = nextNoWhitespace(xpp);
2392    while (eventType != XmlPullParser.END_TAG) {
2393    if (!parseAccountCoverageComponentContent(eventType, xpp, res))
2394        unknownContent(xpp);
2395      eventType = nextNoWhitespace(xpp);
2396    }
2397    next(xpp);
2398    parseElementClose(res);
2399    return res;
2400  }
2401
2402  protected boolean parseAccountCoverageComponentContent(int eventType, XmlPullParser xpp, Account.CoverageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2403    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
2404      res.setCoverage(parseReference(xpp));
2405    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
2406      res.setPriorityElement(parsePositiveInt(xpp));
2407    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2408      return false;
2409    }
2410    return true;
2411  }
2412
2413  protected Account.GuarantorComponent parseAccountGuarantorComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2414    Account.GuarantorComponent res = new Account.GuarantorComponent();
2415    parseElementAttributes(xpp, res);
2416    next(xpp);
2417    int eventType = nextNoWhitespace(xpp);
2418    while (eventType != XmlPullParser.END_TAG) {
2419    if (!parseAccountGuarantorComponentContent(eventType, xpp, res))
2420        unknownContent(xpp);
2421      eventType = nextNoWhitespace(xpp);
2422    }
2423    next(xpp);
2424    parseElementClose(res);
2425    return res;
2426  }
2427
2428  protected boolean parseAccountGuarantorComponentContent(int eventType, XmlPullParser xpp, Account.GuarantorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2429    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
2430      res.setParty(parseReference(xpp));
2431    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onHold")) {
2432      res.setOnHoldElement(parseBoolean(xpp));
2433    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
2434      res.setPeriod(parsePeriod(xpp));
2435    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2436      return false;
2437    }
2438    return true;
2439  }
2440
2441  protected Account.AccountRelatedAccountComponent parseAccountRelatedAccountComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2442    Account.AccountRelatedAccountComponent res = new Account.AccountRelatedAccountComponent();
2443    parseElementAttributes(xpp, res);
2444    next(xpp);
2445    int eventType = nextNoWhitespace(xpp);
2446    while (eventType != XmlPullParser.END_TAG) {
2447    if (!parseAccountRelatedAccountComponentContent(eventType, xpp, res))
2448        unknownContent(xpp);
2449      eventType = nextNoWhitespace(xpp);
2450    }
2451    next(xpp);
2452    parseElementClose(res);
2453    return res;
2454  }
2455
2456  protected boolean parseAccountRelatedAccountComponentContent(int eventType, XmlPullParser xpp, Account.AccountRelatedAccountComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2457    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
2458      res.setRelationship(parseCodeableConcept(xpp));
2459    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("account")) {
2460      res.setAccount(parseReference(xpp));
2461    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2462      return false;
2463    }
2464    return true;
2465  }
2466
2467  protected Account.AccountBalanceComponent parseAccountBalanceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2468    Account.AccountBalanceComponent res = new Account.AccountBalanceComponent();
2469    parseElementAttributes(xpp, res);
2470    next(xpp);
2471    int eventType = nextNoWhitespace(xpp);
2472    while (eventType != XmlPullParser.END_TAG) {
2473    if (!parseAccountBalanceComponentContent(eventType, xpp, res))
2474        unknownContent(xpp);
2475      eventType = nextNoWhitespace(xpp);
2476    }
2477    next(xpp);
2478    parseElementClose(res);
2479    return res;
2480  }
2481
2482  protected boolean parseAccountBalanceComponentContent(int eventType, XmlPullParser xpp, Account.AccountBalanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2483    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("aggregate")) {
2484      res.setAggregate(parseCodeableConcept(xpp));
2485    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("term")) {
2486      res.setTerm(parseCodeableConcept(xpp));
2487    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("estimate")) {
2488      res.setEstimateElement(parseBoolean(xpp));
2489    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
2490      res.setAmount(parseMoney(xpp));
2491    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2492      return false;
2493    }
2494    return true;
2495  }
2496
2497  protected ActivityDefinition parseActivityDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2498    ActivityDefinition res = new ActivityDefinition();
2499    parseResourceAttributes(xpp, res);
2500    next(xpp);
2501    int eventType = nextNoWhitespace(xpp);
2502    while (eventType != XmlPullParser.END_TAG) {
2503    if (!parseActivityDefinitionContent(eventType, xpp, res))
2504        unknownContent(xpp);
2505      eventType = nextNoWhitespace(xpp);
2506    }
2507    next(xpp);
2508    parseElementClose(res);
2509    return res;
2510  }
2511
2512  protected boolean parseActivityDefinitionContent(int eventType, XmlPullParser xpp, ActivityDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
2513    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
2514      res.setUrlElement(parseUri(xpp));
2515    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
2516      res.getIdentifier().add(parseIdentifier(xpp));
2517    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
2518      res.setVersionElement(parseString(xpp));
2519    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
2520      res.setNameElement(parseString(xpp));
2521    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
2522      res.setTitleElement(parseString(xpp));
2523    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtitle")) {
2524      res.setSubtitleElement(parseString(xpp));
2525    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
2526      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2527    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
2528      res.setExperimentalElement(parseBoolean(xpp));
2529    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "subject")) {
2530      res.setSubject(parseType("subject", xpp));
2531    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
2532      res.setDateElement(parseDateTime(xpp));
2533    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
2534      res.setPublisherElement(parseString(xpp));
2535    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
2536      res.getContact().add(parseContactDetail(xpp));
2537    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
2538      res.setDescriptionElement(parseMarkdown(xpp));
2539    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
2540      res.getUseContext().add(parseUsageContext(xpp));
2541    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
2542      res.getJurisdiction().add(parseCodeableConcept(xpp));
2543    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
2544      res.setPurposeElement(parseMarkdown(xpp));
2545    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usage")) {
2546      res.setUsageElement(parseString(xpp));
2547    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
2548      res.setCopyrightElement(parseMarkdown(xpp));
2549    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
2550      res.setApprovalDateElement(parseDate(xpp));
2551    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
2552      res.setLastReviewDateElement(parseDate(xpp));
2553    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
2554      res.setEffectivePeriod(parsePeriod(xpp));
2555    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
2556      res.getTopic().add(parseCodeableConcept(xpp));
2557    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
2558      res.getAuthor().add(parseContactDetail(xpp));
2559    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
2560      res.getEditor().add(parseContactDetail(xpp));
2561    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
2562      res.getReviewer().add(parseContactDetail(xpp));
2563    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
2564      res.getEndorser().add(parseContactDetail(xpp));
2565    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
2566      res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
2567    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("library")) {
2568      res.getLibrary().add(parseCanonical(xpp));
2569    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
2570      res.setKindElement(parseEnumeration(xpp, ActivityDefinition.RequestResourceTypes.NULL, new ActivityDefinition.RequestResourceTypesEnumFactory()));
2571    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
2572      res.setProfileElement(parseCanonical(xpp));
2573    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
2574      res.setCode(parseCodeableConcept(xpp));
2575    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
2576      res.setIntentElement(parseEnumeration(xpp, Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
2577    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
2578      res.setPriorityElement(parseEnumeration(xpp, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
2579    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
2580      res.setDoNotPerformElement(parseBoolean(xpp));
2581    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
2582      res.setTiming(parseType("timing", xpp));
2583    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "asNeeded")) {
2584      res.setAsNeeded(parseType("asNeeded", xpp));
2585    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
2586      res.setLocation(parseCodeableReference(xpp));
2587    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
2588      res.getParticipant().add(parseActivityDefinitionParticipantComponent(xpp));
2589    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "product")) {
2590      res.setProduct(parseType("product", xpp));
2591    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
2592      res.setQuantity(parseQuantity(xpp));
2593    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dosage")) {
2594      res.getDosage().add(parseDosage(xpp));
2595    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
2596      res.getBodySite().add(parseCodeableConcept(xpp));
2597    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specimenRequirement")) {
2598      res.getSpecimenRequirement().add(parseCanonical(xpp));
2599    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observationRequirement")) {
2600      res.getObservationRequirement().add(parseCanonical(xpp));
2601    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observationResultRequirement")) {
2602      res.getObservationResultRequirement().add(parseCanonical(xpp));
2603    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("transform")) {
2604      res.setTransformElement(parseCanonical(xpp));
2605    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dynamicValue")) {
2606      res.getDynamicValue().add(parseActivityDefinitionDynamicValueComponent(xpp));
2607    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
2608      return false;
2609    }
2610    return true;
2611  }
2612
2613  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2614    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2615    parseElementAttributes(xpp, res);
2616    next(xpp);
2617    int eventType = nextNoWhitespace(xpp);
2618    while (eventType != XmlPullParser.END_TAG) {
2619    if (!parseActivityDefinitionParticipantComponentContent(eventType, xpp, res))
2620        unknownContent(xpp);
2621      eventType = nextNoWhitespace(xpp);
2622    }
2623    next(xpp);
2624    parseElementClose(res);
2625    return res;
2626  }
2627
2628  protected boolean parseActivityDefinitionParticipantComponentContent(int eventType, XmlPullParser xpp, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2629    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2630      res.setTypeElement(parseEnumeration(xpp, Enumerations.ActionParticipantType.NULL, new Enumerations.ActionParticipantTypeEnumFactory()));
2631    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("typeCanonical")) {
2632      res.setTypeCanonicalElement(parseCanonical(xpp));
2633    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("typeReference")) {
2634      res.setTypeReference(parseReference(xpp));
2635    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
2636      res.setRole(parseCodeableConcept(xpp));
2637    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
2638      res.setFunction(parseCodeableConcept(xpp));
2639    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2640      return false;
2641    }
2642    return true;
2643  }
2644
2645  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionDynamicValueComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2646    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2647    parseElementAttributes(xpp, res);
2648    next(xpp);
2649    int eventType = nextNoWhitespace(xpp);
2650    while (eventType != XmlPullParser.END_TAG) {
2651    if (!parseActivityDefinitionDynamicValueComponentContent(eventType, xpp, res))
2652        unknownContent(xpp);
2653      eventType = nextNoWhitespace(xpp);
2654    }
2655    next(xpp);
2656    parseElementClose(res);
2657    return res;
2658  }
2659
2660  protected boolean parseActivityDefinitionDynamicValueComponentContent(int eventType, XmlPullParser xpp, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2661    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
2662      res.setPathElement(parseString(xpp));
2663    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expression")) {
2664      res.setExpression(parseExpression(xpp));
2665    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2666      return false;
2667    }
2668    return true;
2669  }
2670
2671  protected ActorDefinition parseActorDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2672    ActorDefinition res = new ActorDefinition();
2673    parseResourceAttributes(xpp, res);
2674    next(xpp);
2675    int eventType = nextNoWhitespace(xpp);
2676    while (eventType != XmlPullParser.END_TAG) {
2677    if (!parseActorDefinitionContent(eventType, xpp, res))
2678        unknownContent(xpp);
2679      eventType = nextNoWhitespace(xpp);
2680    }
2681    next(xpp);
2682    parseElementClose(res);
2683    return res;
2684  }
2685
2686  protected boolean parseActorDefinitionContent(int eventType, XmlPullParser xpp, ActorDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
2687    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
2688      res.setUrlElement(parseUri(xpp));
2689    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
2690      res.getIdentifier().add(parseIdentifier(xpp));
2691    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
2692      res.setVersionElement(parseString(xpp));
2693    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
2694      res.setNameElement(parseString(xpp));
2695    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
2696      res.setTitleElement(parseString(xpp));
2697    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
2698      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2699    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
2700      res.setExperimentalElement(parseBoolean(xpp));
2701    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
2702      res.setDateElement(parseDateTime(xpp));
2703    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
2704      res.setPublisherElement(parseString(xpp));
2705    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
2706      res.getContact().add(parseContactDetail(xpp));
2707    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
2708      res.setDescriptionElement(parseMarkdown(xpp));
2709    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
2710      res.getUseContext().add(parseUsageContext(xpp));
2711    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
2712      res.getJurisdiction().add(parseCodeableConcept(xpp));
2713    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
2714      res.setPurposeElement(parseMarkdown(xpp));
2715    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
2716      res.setCopyrightElement(parseMarkdown(xpp));
2717    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyrightLabel")) {
2718      res.setCopyrightLabelElement(parseString(xpp));
2719    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2720      res.setTypeElement(parseEnumeration(xpp, Enumerations.ExampleScenarioActorType.NULL, new Enumerations.ExampleScenarioActorTypeEnumFactory()));
2721    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
2722      res.setDocumentationElement(parseMarkdown(xpp));
2723    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
2724      res.getReference().add(parseUrl(xpp));
2725    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("capabilities")) {
2726      res.setCapabilitiesElement(parseCanonical(xpp));
2727    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivedFrom")) {
2728      res.getDerivedFrom().add(parseCanonical(xpp));
2729    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
2730      return false;
2731    }
2732    return true;
2733  }
2734
2735  protected AdministrableProductDefinition parseAdministrableProductDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2736    AdministrableProductDefinition res = new AdministrableProductDefinition();
2737    parseResourceAttributes(xpp, res);
2738    next(xpp);
2739    int eventType = nextNoWhitespace(xpp);
2740    while (eventType != XmlPullParser.END_TAG) {
2741    if (!parseAdministrableProductDefinitionContent(eventType, xpp, res))
2742        unknownContent(xpp);
2743      eventType = nextNoWhitespace(xpp);
2744    }
2745    next(xpp);
2746    parseElementClose(res);
2747    return res;
2748  }
2749
2750  protected boolean parseAdministrableProductDefinitionContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
2751    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
2752      res.getIdentifier().add(parseIdentifier(xpp));
2753    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
2754      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2755    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("formOf")) {
2756      res.getFormOf().add(parseReference(xpp));
2757    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("administrableDoseForm")) {
2758      res.setAdministrableDoseForm(parseCodeableConcept(xpp));
2759    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitOfPresentation")) {
2760      res.setUnitOfPresentation(parseCodeableConcept(xpp));
2761    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("producedFrom")) {
2762      res.getProducedFrom().add(parseReference(xpp));
2763    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ingredient")) {
2764      res.getIngredient().add(parseCodeableConcept(xpp));
2765    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("device")) {
2766      res.setDevice(parseReference(xpp));
2767    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
2768      res.getProperty().add(parseAdministrableProductDefinitionPropertyComponent(xpp));
2769    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("routeOfAdministration")) {
2770      res.getRouteOfAdministration().add(parseAdministrableProductDefinitionRouteOfAdministrationComponent(xpp));
2771    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
2772      return false;
2773    }
2774    return true;
2775  }
2776
2777  protected AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent parseAdministrableProductDefinitionPropertyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2778    AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent();
2779    parseElementAttributes(xpp, res);
2780    next(xpp);
2781    int eventType = nextNoWhitespace(xpp);
2782    while (eventType != XmlPullParser.END_TAG) {
2783    if (!parseAdministrableProductDefinitionPropertyComponentContent(eventType, xpp, res))
2784        unknownContent(xpp);
2785      eventType = nextNoWhitespace(xpp);
2786    }
2787    next(xpp);
2788    parseElementClose(res);
2789    return res;
2790  }
2791
2792  protected boolean parseAdministrableProductDefinitionPropertyComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionPropertyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2793    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2794      res.setType(parseCodeableConcept(xpp));
2795    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
2796      res.setValue(parseType("value", xpp));
2797    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
2798      res.setStatus(parseCodeableConcept(xpp));
2799    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2800      return false;
2801    }
2802    return true;
2803  }
2804
2805  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent parseAdministrableProductDefinitionRouteOfAdministrationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2806    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent();
2807    parseElementAttributes(xpp, res);
2808    next(xpp);
2809    int eventType = nextNoWhitespace(xpp);
2810    while (eventType != XmlPullParser.END_TAG) {
2811    if (!parseAdministrableProductDefinitionRouteOfAdministrationComponentContent(eventType, xpp, res))
2812        unknownContent(xpp);
2813      eventType = nextNoWhitespace(xpp);
2814    }
2815    next(xpp);
2816    parseElementClose(res);
2817    return res;
2818  }
2819
2820  protected boolean parseAdministrableProductDefinitionRouteOfAdministrationComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2821    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
2822      res.setCode(parseCodeableConcept(xpp));
2823    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("firstDose")) {
2824      res.setFirstDose(parseQuantity(xpp));
2825    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxSingleDose")) {
2826      res.setMaxSingleDose(parseQuantity(xpp));
2827    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerDay")) {
2828      res.setMaxDosePerDay(parseQuantity(xpp));
2829    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxDosePerTreatmentPeriod")) {
2830      res.setMaxDosePerTreatmentPeriod(parseRatio(xpp));
2831    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxTreatmentPeriod")) {
2832      res.setMaxTreatmentPeriod(parseDuration(xpp));
2833    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("targetSpecies")) {
2834      res.getTargetSpecies().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(xpp));
2835    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2836      return false;
2837    }
2838    return true;
2839  }
2840
2841  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2842    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
2843    parseElementAttributes(xpp, res);
2844    next(xpp);
2845    int eventType = nextNoWhitespace(xpp);
2846    while (eventType != XmlPullParser.END_TAG) {
2847    if (!parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentContent(eventType, xpp, res))
2848        unknownContent(xpp);
2849      eventType = nextNoWhitespace(xpp);
2850    }
2851    next(xpp);
2852    parseElementClose(res);
2853    return res;
2854  }
2855
2856  protected boolean parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2857    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
2858      res.setCode(parseCodeableConcept(xpp));
2859    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("withdrawalPeriod")) {
2860      res.getWithdrawalPeriod().add(parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(xpp));
2861    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2862      return false;
2863    }
2864    return true;
2865  }
2866
2867  protected AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2868    AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
2869    parseElementAttributes(xpp, res);
2870    next(xpp);
2871    int eventType = nextNoWhitespace(xpp);
2872    while (eventType != XmlPullParser.END_TAG) {
2873    if (!parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentContent(eventType, xpp, res))
2874        unknownContent(xpp);
2875      eventType = nextNoWhitespace(xpp);
2876    }
2877    next(xpp);
2878    parseElementClose(res);
2879    return res;
2880  }
2881
2882  protected boolean parseAdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentContent(int eventType, XmlPullParser xpp, AdministrableProductDefinition.AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2883    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tissue")) {
2884      res.setTissue(parseCodeableConcept(xpp));
2885    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
2886      res.setValue(parseQuantity(xpp));
2887    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
2888      res.setSupportingInformationElement(parseString(xpp));
2889    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2890      return false;
2891    }
2892    return true;
2893  }
2894
2895  protected AdverseEvent parseAdverseEvent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2896    AdverseEvent res = new AdverseEvent();
2897    parseResourceAttributes(xpp, res);
2898    next(xpp);
2899    int eventType = nextNoWhitespace(xpp);
2900    while (eventType != XmlPullParser.END_TAG) {
2901    if (!parseAdverseEventContent(eventType, xpp, res))
2902        unknownContent(xpp);
2903      eventType = nextNoWhitespace(xpp);
2904    }
2905    next(xpp);
2906    parseElementClose(res);
2907    return res;
2908  }
2909
2910  protected boolean parseAdverseEventContent(int eventType, XmlPullParser xpp, AdverseEvent res) throws XmlPullParserException, IOException, FHIRFormatError {
2911    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
2912      res.getIdentifier().add(parseIdentifier(xpp));
2913    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
2914      res.setStatusElement(parseEnumeration(xpp, AdverseEvent.AdverseEventStatus.NULL, new AdverseEvent.AdverseEventStatusEnumFactory()));
2915    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actuality")) {
2916      res.setActualityElement(parseEnumeration(xpp, AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2917    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
2918      res.getCategory().add(parseCodeableConcept(xpp));
2919    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
2920      res.setCode(parseCodeableConcept(xpp));
2921    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
2922      res.setSubject(parseReference(xpp));
2923    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
2924      res.setEncounter(parseReference(xpp));
2925    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
2926      res.setOccurrence(parseType("occurrence", xpp));
2927    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detected")) {
2928      res.setDetectedElement(parseDateTime(xpp));
2929    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recordedDate")) {
2930      res.setRecordedDateElement(parseDateTime(xpp));
2931    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resultingCondition")) {
2932      res.getResultingCondition().add(parseReference(xpp));
2933    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
2934      res.setLocation(parseReference(xpp));
2935    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("seriousness")) {
2936      res.setSeriousness(parseCodeableConcept(xpp));
2937    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
2938      res.getOutcome().add(parseCodeableConcept(xpp));
2939    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorder")) {
2940      res.setRecorder(parseReference(xpp));
2941    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
2942      res.getParticipant().add(parseAdverseEventParticipantComponent(xpp));
2943    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("study")) {
2944      res.getStudy().add(parseReference(xpp));
2945    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expectedInResearchStudy")) {
2946      res.setExpectedInResearchStudyElement(parseBoolean(xpp));
2947    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suspectEntity")) {
2948      res.getSuspectEntity().add(parseAdverseEventSuspectEntityComponent(xpp));
2949    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributingFactor")) {
2950      res.getContributingFactor().add(parseAdverseEventContributingFactorComponent(xpp));
2951    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preventiveAction")) {
2952      res.getPreventiveAction().add(parseAdverseEventPreventiveActionComponent(xpp));
2953    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mitigatingAction")) {
2954      res.getMitigatingAction().add(parseAdverseEventMitigatingActionComponent(xpp));
2955    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
2956      res.getSupportingInfo().add(parseAdverseEventSupportingInfoComponent(xpp));
2957    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
2958      res.getNote().add(parseAnnotation(xpp));
2959    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
2960      return false;
2961    }
2962    return true;
2963  }
2964
2965  protected AdverseEvent.AdverseEventParticipantComponent parseAdverseEventParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2966    AdverseEvent.AdverseEventParticipantComponent res = new AdverseEvent.AdverseEventParticipantComponent();
2967    parseElementAttributes(xpp, res);
2968    next(xpp);
2969    int eventType = nextNoWhitespace(xpp);
2970    while (eventType != XmlPullParser.END_TAG) {
2971    if (!parseAdverseEventParticipantComponentContent(eventType, xpp, res))
2972        unknownContent(xpp);
2973      eventType = nextNoWhitespace(xpp);
2974    }
2975    next(xpp);
2976    parseElementClose(res);
2977    return res;
2978  }
2979
2980  protected boolean parseAdverseEventParticipantComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
2981    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
2982      res.setFunction(parseCodeableConcept(xpp));
2983    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
2984      res.setActor(parseReference(xpp));
2985    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
2986      return false;
2987    }
2988    return true;
2989  }
2990
2991  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventSuspectEntityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2992    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2993    parseElementAttributes(xpp, res);
2994    next(xpp);
2995    int eventType = nextNoWhitespace(xpp);
2996    while (eventType != XmlPullParser.END_TAG) {
2997    if (!parseAdverseEventSuspectEntityComponentContent(eventType, xpp, res))
2998        unknownContent(xpp);
2999      eventType = nextNoWhitespace(xpp);
3000    }
3001    next(xpp);
3002    parseElementClose(res);
3003    return res;
3004  }
3005
3006  protected boolean parseAdverseEventSuspectEntityComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventSuspectEntityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3007    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "instance")) {
3008      res.setInstance(parseType("instance", xpp));
3009    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("causality")) {
3010      res.setCausality(parseAdverseEventSuspectEntityCausalityComponent(xpp));
3011    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3012      return false;
3013    }
3014    return true;
3015  }
3016
3017  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventSuspectEntityCausalityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3018    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
3019    parseElementAttributes(xpp, res);
3020    next(xpp);
3021    int eventType = nextNoWhitespace(xpp);
3022    while (eventType != XmlPullParser.END_TAG) {
3023    if (!parseAdverseEventSuspectEntityCausalityComponentContent(eventType, xpp, res))
3024        unknownContent(xpp);
3025      eventType = nextNoWhitespace(xpp);
3026    }
3027    next(xpp);
3028    parseElementClose(res);
3029    return res;
3030  }
3031
3032  protected boolean parseAdverseEventSuspectEntityCausalityComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3033    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assessmentMethod")) {
3034      res.setAssessmentMethod(parseCodeableConcept(xpp));
3035    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entityRelatedness")) {
3036      res.setEntityRelatedness(parseCodeableConcept(xpp));
3037    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
3038      res.setAuthor(parseReference(xpp));
3039    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3040      return false;
3041    }
3042    return true;
3043  }
3044
3045  protected AdverseEvent.AdverseEventContributingFactorComponent parseAdverseEventContributingFactorComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3046    AdverseEvent.AdverseEventContributingFactorComponent res = new AdverseEvent.AdverseEventContributingFactorComponent();
3047    parseElementAttributes(xpp, res);
3048    next(xpp);
3049    int eventType = nextNoWhitespace(xpp);
3050    while (eventType != XmlPullParser.END_TAG) {
3051    if (!parseAdverseEventContributingFactorComponentContent(eventType, xpp, res))
3052        unknownContent(xpp);
3053      eventType = nextNoWhitespace(xpp);
3054    }
3055    next(xpp);
3056    parseElementClose(res);
3057    return res;
3058  }
3059
3060  protected boolean parseAdverseEventContributingFactorComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventContributingFactorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3061    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
3062      res.setItem(parseType("item", xpp));
3063    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3064      return false;
3065    }
3066    return true;
3067  }
3068
3069  protected AdverseEvent.AdverseEventPreventiveActionComponent parseAdverseEventPreventiveActionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3070    AdverseEvent.AdverseEventPreventiveActionComponent res = new AdverseEvent.AdverseEventPreventiveActionComponent();
3071    parseElementAttributes(xpp, res);
3072    next(xpp);
3073    int eventType = nextNoWhitespace(xpp);
3074    while (eventType != XmlPullParser.END_TAG) {
3075    if (!parseAdverseEventPreventiveActionComponentContent(eventType, xpp, res))
3076        unknownContent(xpp);
3077      eventType = nextNoWhitespace(xpp);
3078    }
3079    next(xpp);
3080    parseElementClose(res);
3081    return res;
3082  }
3083
3084  protected boolean parseAdverseEventPreventiveActionComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventPreventiveActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3085    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
3086      res.setItem(parseType("item", xpp));
3087    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3088      return false;
3089    }
3090    return true;
3091  }
3092
3093  protected AdverseEvent.AdverseEventMitigatingActionComponent parseAdverseEventMitigatingActionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3094    AdverseEvent.AdverseEventMitigatingActionComponent res = new AdverseEvent.AdverseEventMitigatingActionComponent();
3095    parseElementAttributes(xpp, res);
3096    next(xpp);
3097    int eventType = nextNoWhitespace(xpp);
3098    while (eventType != XmlPullParser.END_TAG) {
3099    if (!parseAdverseEventMitigatingActionComponentContent(eventType, xpp, res))
3100        unknownContent(xpp);
3101      eventType = nextNoWhitespace(xpp);
3102    }
3103    next(xpp);
3104    parseElementClose(res);
3105    return res;
3106  }
3107
3108  protected boolean parseAdverseEventMitigatingActionComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventMitigatingActionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3109    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
3110      res.setItem(parseType("item", xpp));
3111    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3112      return false;
3113    }
3114    return true;
3115  }
3116
3117  protected AdverseEvent.AdverseEventSupportingInfoComponent parseAdverseEventSupportingInfoComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3118    AdverseEvent.AdverseEventSupportingInfoComponent res = new AdverseEvent.AdverseEventSupportingInfoComponent();
3119    parseElementAttributes(xpp, res);
3120    next(xpp);
3121    int eventType = nextNoWhitespace(xpp);
3122    while (eventType != XmlPullParser.END_TAG) {
3123    if (!parseAdverseEventSupportingInfoComponentContent(eventType, xpp, res))
3124        unknownContent(xpp);
3125      eventType = nextNoWhitespace(xpp);
3126    }
3127    next(xpp);
3128    parseElementClose(res);
3129    return res;
3130  }
3131
3132  protected boolean parseAdverseEventSupportingInfoComponentContent(int eventType, XmlPullParser xpp, AdverseEvent.AdverseEventSupportingInfoComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3133    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
3134      res.setItem(parseType("item", xpp));
3135    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3136      return false;
3137    }
3138    return true;
3139  }
3140
3141  protected AllergyIntolerance parseAllergyIntolerance(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3142    AllergyIntolerance res = new AllergyIntolerance();
3143    parseResourceAttributes(xpp, res);
3144    next(xpp);
3145    int eventType = nextNoWhitespace(xpp);
3146    while (eventType != XmlPullParser.END_TAG) {
3147    if (!parseAllergyIntoleranceContent(eventType, xpp, res))
3148        unknownContent(xpp);
3149      eventType = nextNoWhitespace(xpp);
3150    }
3151    next(xpp);
3152    parseElementClose(res);
3153    return res;
3154  }
3155
3156  protected boolean parseAllergyIntoleranceContent(int eventType, XmlPullParser xpp, AllergyIntolerance res) throws XmlPullParserException, IOException, FHIRFormatError {
3157    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
3158      res.getIdentifier().add(parseIdentifier(xpp));
3159    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("clinicalStatus")) {
3160      res.setClinicalStatus(parseCodeableConcept(xpp));
3161    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verificationStatus")) {
3162      res.setVerificationStatus(parseCodeableConcept(xpp));
3163    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3164      res.setTypeElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
3165    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
3166      res.getCategory().add(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
3167    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("criticality")) {
3168      res.setCriticalityElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
3169    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
3170      res.setCode(parseCodeableConcept(xpp));
3171    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
3172      res.setPatient(parseReference(xpp));
3173    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
3174      res.setEncounter(parseReference(xpp));
3175    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "onset")) {
3176      res.setOnset(parseType("onset", xpp));
3177    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recordedDate")) {
3178      res.setRecordedDateElement(parseDateTime(xpp));
3179    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
3180      res.getParticipant().add(parseAllergyIntoleranceParticipantComponent(xpp));
3181    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastOccurrence")) {
3182      res.setLastOccurrenceElement(parseDateTime(xpp));
3183    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
3184      res.getNote().add(parseAnnotation(xpp));
3185    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reaction")) {
3186      res.getReaction().add(parseAllergyIntoleranceReactionComponent(xpp));
3187    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
3188      return false;
3189    }
3190    return true;
3191  }
3192
3193  protected AllergyIntolerance.AllergyIntoleranceParticipantComponent parseAllergyIntoleranceParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3194    AllergyIntolerance.AllergyIntoleranceParticipantComponent res = new AllergyIntolerance.AllergyIntoleranceParticipantComponent();
3195    parseElementAttributes(xpp, res);
3196    next(xpp);
3197    int eventType = nextNoWhitespace(xpp);
3198    while (eventType != XmlPullParser.END_TAG) {
3199    if (!parseAllergyIntoleranceParticipantComponentContent(eventType, xpp, res))
3200        unknownContent(xpp);
3201      eventType = nextNoWhitespace(xpp);
3202    }
3203    next(xpp);
3204    parseElementClose(res);
3205    return res;
3206  }
3207
3208  protected boolean parseAllergyIntoleranceParticipantComponentContent(int eventType, XmlPullParser xpp, AllergyIntolerance.AllergyIntoleranceParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3209    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
3210      res.setFunction(parseCodeableConcept(xpp));
3211    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
3212      res.setActor(parseReference(xpp));
3213    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3214      return false;
3215    }
3216    return true;
3217  }
3218
3219  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceReactionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3220    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
3221    parseElementAttributes(xpp, res);
3222    next(xpp);
3223    int eventType = nextNoWhitespace(xpp);
3224    while (eventType != XmlPullParser.END_TAG) {
3225    if (!parseAllergyIntoleranceReactionComponentContent(eventType, xpp, res))
3226        unknownContent(xpp);
3227      eventType = nextNoWhitespace(xpp);
3228    }
3229    next(xpp);
3230    parseElementClose(res);
3231    return res;
3232  }
3233
3234  protected boolean parseAllergyIntoleranceReactionComponentContent(int eventType, XmlPullParser xpp, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3235    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("substance")) {
3236      res.setSubstance(parseCodeableConcept(xpp));
3237    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manifestation")) {
3238      res.getManifestation().add(parseCodeableReference(xpp));
3239    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
3240      res.setDescriptionElement(parseString(xpp));
3241    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onset")) {
3242      res.setOnsetElement(parseDateTime(xpp));
3243    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
3244      res.setSeverityElement(parseEnumeration(xpp, AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
3245    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("exposureRoute")) {
3246      res.setExposureRoute(parseCodeableConcept(xpp));
3247    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
3248      res.getNote().add(parseAnnotation(xpp));
3249    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3250      return false;
3251    }
3252    return true;
3253  }
3254
3255  protected Appointment parseAppointment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3256    Appointment res = new Appointment();
3257    parseResourceAttributes(xpp, res);
3258    next(xpp);
3259    int eventType = nextNoWhitespace(xpp);
3260    while (eventType != XmlPullParser.END_TAG) {
3261    if (!parseAppointmentContent(eventType, xpp, res))
3262        unknownContent(xpp);
3263      eventType = nextNoWhitespace(xpp);
3264    }
3265    next(xpp);
3266    parseElementClose(res);
3267    return res;
3268  }
3269
3270  protected boolean parseAppointmentContent(int eventType, XmlPullParser xpp, Appointment res) throws XmlPullParserException, IOException, FHIRFormatError {
3271    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
3272      res.getIdentifier().add(parseIdentifier(xpp));
3273    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
3274      res.setStatusElement(parseEnumeration(xpp, Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
3275    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cancellationReason")) {
3276      res.setCancellationReason(parseCodeableConcept(xpp));
3277    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("class")) {
3278      res.getClass_().add(parseCodeableConcept(xpp));
3279    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceCategory")) {
3280      res.getServiceCategory().add(parseCodeableConcept(xpp));
3281    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("serviceType")) {
3282      res.getServiceType().add(parseCodeableReference(xpp));
3283    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
3284      res.getSpecialty().add(parseCodeableConcept(xpp));
3285    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appointmentType")) {
3286      res.setAppointmentType(parseCodeableConcept(xpp));
3287    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
3288      res.getReason().add(parseCodeableReference(xpp));
3289    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
3290      res.setPriority(parseCodeableConcept(xpp));
3291    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
3292      res.setDescriptionElement(parseString(xpp));
3293    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
3294      res.getReplaces().add(parseReference(xpp));
3295    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("virtualService")) {
3296      res.getVirtualService().add(parseVirtualServiceDetail(xpp));
3297    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
3298      res.getSupportingInformation().add(parseReference(xpp));
3299    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("previousAppointment")) {
3300      res.setPreviousAppointment(parseReference(xpp));
3301    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("originatingAppointment")) {
3302      res.setOriginatingAppointment(parseReference(xpp));
3303    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
3304      res.setStartElement(parseInstant(xpp));
3305    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
3306      res.setEndElement(parseInstant(xpp));
3307    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("minutesDuration")) {
3308      res.setMinutesDurationElement(parsePositiveInt(xpp));
3309    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("slot")) {
3310      res.getSlot().add(parseReference(xpp));
3311    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("account")) {
3312      res.getAccount().add(parseReference(xpp));
3313    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
3314      res.setCreatedElement(parseDateTime(xpp));
3315    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
3316      res.getNote().add(parseAnnotation(xpp));
3317    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientInstruction")) {
3318      res.getPatientInstruction().add(parseCodeableReference(xpp));
3319    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
3320      res.getBasedOn().add(parseReference(xpp));
3321    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
3322      res.setSubject(parseReference(xpp));
3323    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
3324      res.getParticipant().add(parseAppointmentParticipantComponent(xpp));
3325    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestedPeriod")) {
3326      res.getRequestedPeriod().add(parsePeriod(xpp));
3327    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recurrenceId")) {
3328      res.setRecurrenceIdElement(parsePositiveInt(xpp));
3329    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("occurrenceChanged")) {
3330      res.setOccurrenceChangedElement(parseBoolean(xpp));
3331    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recurrenceTemplate")) {
3332      res.getRecurrenceTemplate().add(parseAppointmentRecurrenceTemplateComponent(xpp));
3333    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
3334      return false;
3335    }
3336    return true;
3337  }
3338
3339  protected Appointment.AppointmentParticipantComponent parseAppointmentParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3340    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
3341    parseElementAttributes(xpp, res);
3342    next(xpp);
3343    int eventType = nextNoWhitespace(xpp);
3344    while (eventType != XmlPullParser.END_TAG) {
3345    if (!parseAppointmentParticipantComponentContent(eventType, xpp, res))
3346        unknownContent(xpp);
3347      eventType = nextNoWhitespace(xpp);
3348    }
3349    next(xpp);
3350    parseElementClose(res);
3351    return res;
3352  }
3353
3354  protected boolean parseAppointmentParticipantComponentContent(int eventType, XmlPullParser xpp, Appointment.AppointmentParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3355    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3356      res.getType().add(parseCodeableConcept(xpp));
3357    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
3358      res.setPeriod(parsePeriod(xpp));
3359    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
3360      res.setActor(parseReference(xpp));
3361    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("required")) {
3362      res.setRequiredElement(parseBoolean(xpp));
3363    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
3364      res.setStatusElement(parseEnumeration(xpp, Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3365    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3366      return false;
3367    }
3368    return true;
3369  }
3370
3371  protected Appointment.AppointmentRecurrenceTemplateComponent parseAppointmentRecurrenceTemplateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3372    Appointment.AppointmentRecurrenceTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateComponent();
3373    parseElementAttributes(xpp, res);
3374    next(xpp);
3375    int eventType = nextNoWhitespace(xpp);
3376    while (eventType != XmlPullParser.END_TAG) {
3377    if (!parseAppointmentRecurrenceTemplateComponentContent(eventType, xpp, res))
3378        unknownContent(xpp);
3379      eventType = nextNoWhitespace(xpp);
3380    }
3381    next(xpp);
3382    parseElementClose(res);
3383    return res;
3384  }
3385
3386  protected boolean parseAppointmentRecurrenceTemplateComponentContent(int eventType, XmlPullParser xpp, Appointment.AppointmentRecurrenceTemplateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3387    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timezone")) {
3388      res.setTimezone(parseCodeableConcept(xpp));
3389    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recurrenceType")) {
3390      res.setRecurrenceType(parseCodeableConcept(xpp));
3391    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastOccurrenceDate")) {
3392      res.setLastOccurrenceDateElement(parseDate(xpp));
3393    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("occurrenceCount")) {
3394      res.setOccurrenceCountElement(parsePositiveInt(xpp));
3395    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("occurrenceDate")) {
3396      res.getOccurrenceDate().add(parseDate(xpp));
3397    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("weeklyTemplate")) {
3398      res.setWeeklyTemplate(parseAppointmentRecurrenceTemplateWeeklyTemplateComponent(xpp));
3399    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monthlyTemplate")) {
3400      res.setMonthlyTemplate(parseAppointmentRecurrenceTemplateMonthlyTemplateComponent(xpp));
3401    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("yearlyTemplate")) {
3402      res.setYearlyTemplate(parseAppointmentRecurrenceTemplateYearlyTemplateComponent(xpp));
3403    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludingDate")) {
3404      res.getExcludingDate().add(parseDate(xpp));
3405    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludingRecurrenceId")) {
3406      res.getExcludingRecurrenceId().add(parsePositiveInt(xpp));
3407    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3408      return false;
3409    }
3410    return true;
3411  }
3412
3413  protected Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent parseAppointmentRecurrenceTemplateWeeklyTemplateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3414    Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent();
3415    parseElementAttributes(xpp, res);
3416    next(xpp);
3417    int eventType = nextNoWhitespace(xpp);
3418    while (eventType != XmlPullParser.END_TAG) {
3419    if (!parseAppointmentRecurrenceTemplateWeeklyTemplateComponentContent(eventType, xpp, res))
3420        unknownContent(xpp);
3421      eventType = nextNoWhitespace(xpp);
3422    }
3423    next(xpp);
3424    parseElementClose(res);
3425    return res;
3426  }
3427
3428  protected boolean parseAppointmentRecurrenceTemplateWeeklyTemplateComponentContent(int eventType, XmlPullParser xpp, Appointment.AppointmentRecurrenceTemplateWeeklyTemplateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3429    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monday")) {
3430      res.setMondayElement(parseBoolean(xpp));
3431    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tuesday")) {
3432      res.setTuesdayElement(parseBoolean(xpp));
3433    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("wednesday")) {
3434      res.setWednesdayElement(parseBoolean(xpp));
3435    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("thursday")) {
3436      res.setThursdayElement(parseBoolean(xpp));
3437    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("friday")) {
3438      res.setFridayElement(parseBoolean(xpp));
3439    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("saturday")) {
3440      res.setSaturdayElement(parseBoolean(xpp));
3441    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sunday")) {
3442      res.setSundayElement(parseBoolean(xpp));
3443    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("weekInterval")) {
3444      res.setWeekIntervalElement(parsePositiveInt(xpp));
3445    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3446      return false;
3447    }
3448    return true;
3449  }
3450
3451  protected Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent parseAppointmentRecurrenceTemplateMonthlyTemplateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3452    Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent();
3453    parseElementAttributes(xpp, res);
3454    next(xpp);
3455    int eventType = nextNoWhitespace(xpp);
3456    while (eventType != XmlPullParser.END_TAG) {
3457    if (!parseAppointmentRecurrenceTemplateMonthlyTemplateComponentContent(eventType, xpp, res))
3458        unknownContent(xpp);
3459      eventType = nextNoWhitespace(xpp);
3460    }
3461    next(xpp);
3462    parseElementClose(res);
3463    return res;
3464  }
3465
3466  protected boolean parseAppointmentRecurrenceTemplateMonthlyTemplateComponentContent(int eventType, XmlPullParser xpp, Appointment.AppointmentRecurrenceTemplateMonthlyTemplateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3467    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dayOfMonth")) {
3468      res.setDayOfMonthElement(parsePositiveInt(xpp));
3469    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nthWeekOfMonth")) {
3470      res.setNthWeekOfMonth(parseCoding(xpp));
3471    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dayOfWeek")) {
3472      res.setDayOfWeek(parseCoding(xpp));
3473    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("monthInterval")) {
3474      res.setMonthIntervalElement(parsePositiveInt(xpp));
3475    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3476      return false;
3477    }
3478    return true;
3479  }
3480
3481  protected Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent parseAppointmentRecurrenceTemplateYearlyTemplateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3482    Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent res = new Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent();
3483    parseElementAttributes(xpp, res);
3484    next(xpp);
3485    int eventType = nextNoWhitespace(xpp);
3486    while (eventType != XmlPullParser.END_TAG) {
3487    if (!parseAppointmentRecurrenceTemplateYearlyTemplateComponentContent(eventType, xpp, res))
3488        unknownContent(xpp);
3489      eventType = nextNoWhitespace(xpp);
3490    }
3491    next(xpp);
3492    parseElementClose(res);
3493    return res;
3494  }
3495
3496  protected boolean parseAppointmentRecurrenceTemplateYearlyTemplateComponentContent(int eventType, XmlPullParser xpp, Appointment.AppointmentRecurrenceTemplateYearlyTemplateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3497    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("yearInterval")) {
3498      res.setYearIntervalElement(parsePositiveInt(xpp));
3499    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3500      return false;
3501    }
3502    return true;
3503  }
3504
3505  protected AppointmentResponse parseAppointmentResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3506    AppointmentResponse res = new AppointmentResponse();
3507    parseResourceAttributes(xpp, res);
3508    next(xpp);
3509    int eventType = nextNoWhitespace(xpp);
3510    while (eventType != XmlPullParser.END_TAG) {
3511    if (!parseAppointmentResponseContent(eventType, xpp, res))
3512        unknownContent(xpp);
3513      eventType = nextNoWhitespace(xpp);
3514    }
3515    next(xpp);
3516    parseElementClose(res);
3517    return res;
3518  }
3519
3520  protected boolean parseAppointmentResponseContent(int eventType, XmlPullParser xpp, AppointmentResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
3521    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
3522      res.getIdentifier().add(parseIdentifier(xpp));
3523    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appointment")) {
3524      res.setAppointment(parseReference(xpp));
3525    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("proposedNewTime")) {
3526      res.setProposedNewTimeElement(parseBoolean(xpp));
3527    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start")) {
3528      res.setStartElement(parseInstant(xpp));
3529    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end")) {
3530      res.setEndElement(parseInstant(xpp));
3531    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participantType")) {
3532      res.getParticipantType().add(parseCodeableConcept(xpp));
3533    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
3534      res.setActor(parseReference(xpp));
3535    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participantStatus")) {
3536      res.setParticipantStatusElement(parseEnumeration(xpp, Enumerations.ParticipationStatus.NULL, new Enumerations.ParticipationStatusEnumFactory()));
3537    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
3538      res.setCommentElement(parseString(xpp));
3539    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recurring")) {
3540      res.setRecurringElement(parseBoolean(xpp));
3541    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("occurrenceDate")) {
3542      res.setOccurrenceDateElement(parseDate(xpp));
3543    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recurrenceId")) {
3544      res.setRecurrenceIdElement(parsePositiveInt(xpp));
3545    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
3546      return false;
3547    }
3548    return true;
3549  }
3550
3551  protected ArtifactAssessment parseArtifactAssessment(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3552    ArtifactAssessment res = new ArtifactAssessment();
3553    parseResourceAttributes(xpp, res);
3554    next(xpp);
3555    int eventType = nextNoWhitespace(xpp);
3556    while (eventType != XmlPullParser.END_TAG) {
3557    if (!parseArtifactAssessmentContent(eventType, xpp, res))
3558        unknownContent(xpp);
3559      eventType = nextNoWhitespace(xpp);
3560    }
3561    next(xpp);
3562    parseElementClose(res);
3563    return res;
3564  }
3565
3566  protected boolean parseArtifactAssessmentContent(int eventType, XmlPullParser xpp, ArtifactAssessment res) throws XmlPullParserException, IOException, FHIRFormatError {
3567    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
3568      res.getIdentifier().add(parseIdentifier(xpp));
3569    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "citeAs")) {
3570      res.setCiteAs(parseType("citeAs", xpp));
3571    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
3572      res.setDateElement(parseDateTime(xpp));
3573    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
3574      res.setCopyrightElement(parseMarkdown(xpp));
3575    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
3576      res.setApprovalDateElement(parseDate(xpp));
3577    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
3578      res.setLastReviewDateElement(parseDate(xpp));
3579    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "artifact")) {
3580      res.setArtifact(parseType("artifact", xpp));
3581    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
3582      res.getContent().add(parseArtifactAssessmentContentComponent(xpp));
3583    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("workflowStatus")) {
3584      res.setWorkflowStatusElement(parseEnumeration(xpp, ArtifactAssessment.ArtifactAssessmentWorkflowStatus.NULL, new ArtifactAssessment.ArtifactAssessmentWorkflowStatusEnumFactory()));
3585    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
3586      res.setDispositionElement(parseEnumeration(xpp, ArtifactAssessment.ArtifactAssessmentDisposition.NULL, new ArtifactAssessment.ArtifactAssessmentDispositionEnumFactory()));
3587    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
3588      return false;
3589    }
3590    return true;
3591  }
3592
3593  protected ArtifactAssessment.ArtifactAssessmentContentComponent parseArtifactAssessmentContentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3594    ArtifactAssessment.ArtifactAssessmentContentComponent res = new ArtifactAssessment.ArtifactAssessmentContentComponent();
3595    parseElementAttributes(xpp, res);
3596    next(xpp);
3597    int eventType = nextNoWhitespace(xpp);
3598    while (eventType != XmlPullParser.END_TAG) {
3599    if (!parseArtifactAssessmentContentComponentContent(eventType, xpp, res))
3600        unknownContent(xpp);
3601      eventType = nextNoWhitespace(xpp);
3602    }
3603    next(xpp);
3604    parseElementClose(res);
3605    return res;
3606  }
3607
3608  protected boolean parseArtifactAssessmentContentComponentContent(int eventType, XmlPullParser xpp, ArtifactAssessment.ArtifactAssessmentContentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3609    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationType")) {
3610      res.setInformationTypeElement(parseEnumeration(xpp, ArtifactAssessment.ArtifactAssessmentInformationType.NULL, new ArtifactAssessment.ArtifactAssessmentInformationTypeEnumFactory()));
3611    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
3612      res.setSummaryElement(parseMarkdown(xpp));
3613    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3614      res.setType(parseCodeableConcept(xpp));
3615    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classifier")) {
3616      res.getClassifier().add(parseCodeableConcept(xpp));
3617    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
3618      res.setAuthor(parseReference(xpp));
3619    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
3620      res.getPath().add(parseUri(xpp));
3621    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
3622      res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
3623    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("freeToShare")) {
3624      res.setFreeToShareElement(parseBoolean(xpp));
3625    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("component")) {
3626      res.getComponent().add(parseArtifactAssessmentContentComponent(xpp));
3627    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3628      return false;
3629    }
3630    return true;
3631  }
3632
3633  protected AuditEvent parseAuditEvent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3634    AuditEvent res = new AuditEvent();
3635    parseResourceAttributes(xpp, res);
3636    next(xpp);
3637    int eventType = nextNoWhitespace(xpp);
3638    while (eventType != XmlPullParser.END_TAG) {
3639    if (!parseAuditEventContent(eventType, xpp, res))
3640        unknownContent(xpp);
3641      eventType = nextNoWhitespace(xpp);
3642    }
3643    next(xpp);
3644    parseElementClose(res);
3645    return res;
3646  }
3647
3648  protected boolean parseAuditEventContent(int eventType, XmlPullParser xpp, AuditEvent res) throws XmlPullParserException, IOException, FHIRFormatError {
3649    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
3650      res.getCategory().add(parseCodeableConcept(xpp));
3651    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
3652      res.setCode(parseCodeableConcept(xpp));
3653    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action")) {
3654      res.setActionElement(parseEnumeration(xpp, AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
3655    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
3656      res.setSeverityElement(parseEnumeration(xpp, AuditEvent.AuditEventSeverity.NULL, new AuditEvent.AuditEventSeverityEnumFactory()));
3657    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurred")) {
3658      res.setOccurred(parseType("occurred", xpp));
3659    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recorded")) {
3660      res.setRecordedElement(parseInstant(xpp));
3661    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
3662      res.setOutcome(parseAuditEventOutcomeComponent(xpp));
3663    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorization")) {
3664      res.getAuthorization().add(parseCodeableConcept(xpp));
3665    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
3666      res.getBasedOn().add(parseReference(xpp));
3667    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
3668      res.setPatient(parseReference(xpp));
3669    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
3670      res.setEncounter(parseReference(xpp));
3671    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
3672      res.getAgent().add(parseAuditEventAgentComponent(xpp));
3673    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
3674      res.setSource(parseAuditEventSourceComponent(xpp));
3675    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entity")) {
3676      res.getEntity().add(parseAuditEventEntityComponent(xpp));
3677    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
3678      return false;
3679    }
3680    return true;
3681  }
3682
3683  protected AuditEvent.AuditEventOutcomeComponent parseAuditEventOutcomeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3684    AuditEvent.AuditEventOutcomeComponent res = new AuditEvent.AuditEventOutcomeComponent();
3685    parseElementAttributes(xpp, res);
3686    next(xpp);
3687    int eventType = nextNoWhitespace(xpp);
3688    while (eventType != XmlPullParser.END_TAG) {
3689    if (!parseAuditEventOutcomeComponentContent(eventType, xpp, res))
3690        unknownContent(xpp);
3691      eventType = nextNoWhitespace(xpp);
3692    }
3693    next(xpp);
3694    parseElementClose(res);
3695    return res;
3696  }
3697
3698  protected boolean parseAuditEventOutcomeComponentContent(int eventType, XmlPullParser xpp, AuditEvent.AuditEventOutcomeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3699    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
3700      res.setCode(parseCoding(xpp));
3701    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
3702      res.getDetail().add(parseCodeableConcept(xpp));
3703    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3704      return false;
3705    }
3706    return true;
3707  }
3708
3709  protected AuditEvent.AuditEventAgentComponent parseAuditEventAgentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3710    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
3711    parseElementAttributes(xpp, res);
3712    next(xpp);
3713    int eventType = nextNoWhitespace(xpp);
3714    while (eventType != XmlPullParser.END_TAG) {
3715    if (!parseAuditEventAgentComponentContent(eventType, xpp, res))
3716        unknownContent(xpp);
3717      eventType = nextNoWhitespace(xpp);
3718    }
3719    next(xpp);
3720    parseElementClose(res);
3721    return res;
3722  }
3723
3724  protected boolean parseAuditEventAgentComponentContent(int eventType, XmlPullParser xpp, AuditEvent.AuditEventAgentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3725    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3726      res.setType(parseCodeableConcept(xpp));
3727    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
3728      res.getRole().add(parseCodeableConcept(xpp));
3729    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("who")) {
3730      res.setWho(parseReference(xpp));
3731    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestor")) {
3732      res.setRequestorElement(parseBoolean(xpp));
3733    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
3734      res.setLocation(parseReference(xpp));
3735    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("policy")) {
3736      res.getPolicy().add(parseUri(xpp));
3737    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "network")) {
3738      res.setNetwork(parseType("network", xpp));
3739    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authorization")) {
3740      res.getAuthorization().add(parseCodeableConcept(xpp));
3741    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3742      return false;
3743    }
3744    return true;
3745  }
3746
3747  protected AuditEvent.AuditEventSourceComponent parseAuditEventSourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3748    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
3749    parseElementAttributes(xpp, res);
3750    next(xpp);
3751    int eventType = nextNoWhitespace(xpp);
3752    while (eventType != XmlPullParser.END_TAG) {
3753    if (!parseAuditEventSourceComponentContent(eventType, xpp, res))
3754        unknownContent(xpp);
3755      eventType = nextNoWhitespace(xpp);
3756    }
3757    next(xpp);
3758    parseElementClose(res);
3759    return res;
3760  }
3761
3762  protected boolean parseAuditEventSourceComponentContent(int eventType, XmlPullParser xpp, AuditEvent.AuditEventSourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3763    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
3764      res.setSite(parseReference(xpp));
3765    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observer")) {
3766      res.setObserver(parseReference(xpp));
3767    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3768      res.getType().add(parseCodeableConcept(xpp));
3769    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3770      return false;
3771    }
3772    return true;
3773  }
3774
3775  protected AuditEvent.AuditEventEntityComponent parseAuditEventEntityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3776    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
3777    parseElementAttributes(xpp, res);
3778    next(xpp);
3779    int eventType = nextNoWhitespace(xpp);
3780    while (eventType != XmlPullParser.END_TAG) {
3781    if (!parseAuditEventEntityComponentContent(eventType, xpp, res))
3782        unknownContent(xpp);
3783      eventType = nextNoWhitespace(xpp);
3784    }
3785    next(xpp);
3786    parseElementClose(res);
3787    return res;
3788  }
3789
3790  protected boolean parseAuditEventEntityComponentContent(int eventType, XmlPullParser xpp, AuditEvent.AuditEventEntityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3791    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("what")) {
3792      res.setWhat(parseReference(xpp));
3793    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
3794      res.setRole(parseCodeableConcept(xpp));
3795    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityLabel")) {
3796      res.getSecurityLabel().add(parseCodeableConcept(xpp));
3797    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("query")) {
3798      res.setQueryElement(parseBase64Binary(xpp));
3799    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
3800      res.getDetail().add(parseAuditEventEntityDetailComponent(xpp));
3801    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("agent")) {
3802      res.getAgent().add(parseAuditEventAgentComponent(xpp));
3803    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3804      return false;
3805    }
3806    return true;
3807  }
3808
3809  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventEntityDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3810    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
3811    parseElementAttributes(xpp, res);
3812    next(xpp);
3813    int eventType = nextNoWhitespace(xpp);
3814    while (eventType != XmlPullParser.END_TAG) {
3815    if (!parseAuditEventEntityDetailComponentContent(eventType, xpp, res))
3816        unknownContent(xpp);
3817      eventType = nextNoWhitespace(xpp);
3818    }
3819    next(xpp);
3820    parseElementClose(res);
3821    return res;
3822  }
3823
3824  protected boolean parseAuditEventEntityDetailComponentContent(int eventType, XmlPullParser xpp, AuditEvent.AuditEventEntityDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3825    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3826      res.setType(parseCodeableConcept(xpp));
3827    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
3828      res.setValue(parseType("value", xpp));
3829    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3830      return false;
3831    }
3832    return true;
3833  }
3834
3835  protected Basic parseBasic(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3836    Basic res = new Basic();
3837    parseResourceAttributes(xpp, res);
3838    next(xpp);
3839    int eventType = nextNoWhitespace(xpp);
3840    while (eventType != XmlPullParser.END_TAG) {
3841    if (!parseBasicContent(eventType, xpp, res))
3842        unknownContent(xpp);
3843      eventType = nextNoWhitespace(xpp);
3844    }
3845    next(xpp);
3846    parseElementClose(res);
3847    return res;
3848  }
3849
3850  protected boolean parseBasicContent(int eventType, XmlPullParser xpp, Basic res) throws XmlPullParserException, IOException, FHIRFormatError {
3851    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
3852      res.getIdentifier().add(parseIdentifier(xpp));
3853    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
3854      res.setCode(parseCodeableConcept(xpp));
3855    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
3856      res.setSubject(parseReference(xpp));
3857    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
3858      res.setCreatedElement(parseDateTime(xpp));
3859    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
3860      res.setAuthor(parseReference(xpp));
3861    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
3862      return false;
3863    }
3864    return true;
3865  }
3866
3867  protected Binary parseBinary(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3868    Binary res = new Binary();
3869    parseResourceAttributes(xpp, res);
3870    next(xpp);
3871    int eventType = nextNoWhitespace(xpp);
3872    while (eventType != XmlPullParser.END_TAG) {
3873    if (!parseBinaryContent(eventType, xpp, res))
3874        unknownContent(xpp);
3875      eventType = nextNoWhitespace(xpp);
3876    }
3877    next(xpp);
3878    parseElementClose(res);
3879    return res;
3880  }
3881
3882  protected boolean parseBinaryContent(int eventType, XmlPullParser xpp, Binary res) throws XmlPullParserException, IOException, FHIRFormatError {
3883    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contentType")) {
3884      res.setContentTypeElement(parseCode(xpp));
3885    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("securityContext")) {
3886      res.setSecurityContext(parseReference(xpp));
3887    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
3888      res.setDataElement(parseBase64Binary(xpp));
3889    } else if (!parseResourceContent(eventType, xpp, res)){ 
3890      return false;
3891    }
3892    return true;
3893  }
3894
3895  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3896    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3897    parseResourceAttributes(xpp, res);
3898    next(xpp);
3899    int eventType = nextNoWhitespace(xpp);
3900    while (eventType != XmlPullParser.END_TAG) {
3901    if (!parseBiologicallyDerivedProductContent(eventType, xpp, res))
3902        unknownContent(xpp);
3903      eventType = nextNoWhitespace(xpp);
3904    }
3905    next(xpp);
3906    parseElementClose(res);
3907    return res;
3908  }
3909
3910  protected boolean parseBiologicallyDerivedProductContent(int eventType, XmlPullParser xpp, BiologicallyDerivedProduct res) throws XmlPullParserException, IOException, FHIRFormatError {
3911    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productCategory")) {
3912      res.setProductCategory(parseCoding(xpp));
3913    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productCode")) {
3914      res.setProductCode(parseCodeableConcept(xpp));
3915    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent")) {
3916      res.getParent().add(parseReference(xpp));
3917    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
3918      res.getRequest().add(parseReference(xpp));
3919    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
3920      res.getIdentifier().add(parseIdentifier(xpp));
3921    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("biologicalSourceEvent")) {
3922      res.setBiologicalSourceEvent(parseIdentifier(xpp));
3923    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processingFacility")) {
3924      res.getProcessingFacility().add(parseReference(xpp));
3925    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("division")) {
3926      res.setDivisionElement(parseString(xpp));
3927    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productStatus")) {
3928      res.setProductStatus(parseCoding(xpp));
3929    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expirationDate")) {
3930      res.setExpirationDateElement(parseDateTime(xpp));
3931    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collection")) {
3932      res.setCollection(parseBiologicallyDerivedProductCollectionComponent(xpp));
3933    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("storageTempRequirements")) {
3934      res.setStorageTempRequirements(parseRange(xpp));
3935    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
3936      res.getProperty().add(parseBiologicallyDerivedProductPropertyComponent(xpp));
3937    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
3938      return false;
3939    }
3940    return true;
3941  }
3942
3943  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductCollectionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3944    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3945    parseElementAttributes(xpp, res);
3946    next(xpp);
3947    int eventType = nextNoWhitespace(xpp);
3948    while (eventType != XmlPullParser.END_TAG) {
3949    if (!parseBiologicallyDerivedProductCollectionComponentContent(eventType, xpp, res))
3950        unknownContent(xpp);
3951      eventType = nextNoWhitespace(xpp);
3952    }
3953    next(xpp);
3954    parseElementClose(res);
3955    return res;
3956  }
3957
3958  protected boolean parseBiologicallyDerivedProductCollectionComponentContent(int eventType, XmlPullParser xpp, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3959    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("collector")) {
3960      res.setCollector(parseReference(xpp));
3961    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
3962      res.setSource(parseReference(xpp));
3963    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "collected")) {
3964      res.setCollected(parseType("collected", xpp));
3965    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3966      return false;
3967    }
3968    return true;
3969  }
3970
3971  protected BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent parseBiologicallyDerivedProductPropertyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3972    BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent();
3973    parseElementAttributes(xpp, res);
3974    next(xpp);
3975    int eventType = nextNoWhitespace(xpp);
3976    while (eventType != XmlPullParser.END_TAG) {
3977    if (!parseBiologicallyDerivedProductPropertyComponentContent(eventType, xpp, res))
3978        unknownContent(xpp);
3979      eventType = nextNoWhitespace(xpp);
3980    }
3981    next(xpp);
3982    parseElementClose(res);
3983    return res;
3984  }
3985
3986  protected boolean parseBiologicallyDerivedProductPropertyComponentContent(int eventType, XmlPullParser xpp, BiologicallyDerivedProduct.BiologicallyDerivedProductPropertyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
3987    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3988      res.setType(parseCoding(xpp));
3989    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
3990      res.setValue(parseType("value", xpp));
3991    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
3992      return false;
3993    }
3994    return true;
3995  }
3996
3997  protected BodyStructure parseBodyStructure(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3998    BodyStructure res = new BodyStructure();
3999    parseResourceAttributes(xpp, res);
4000    next(xpp);
4001    int eventType = nextNoWhitespace(xpp);
4002    while (eventType != XmlPullParser.END_TAG) {
4003    if (!parseBodyStructureContent(eventType, xpp, res))
4004        unknownContent(xpp);
4005      eventType = nextNoWhitespace(xpp);
4006    }
4007    next(xpp);
4008    parseElementClose(res);
4009    return res;
4010  }
4011
4012  protected boolean parseBodyStructureContent(int eventType, XmlPullParser xpp, BodyStructure res) throws XmlPullParserException, IOException, FHIRFormatError {
4013    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
4014      res.getIdentifier().add(parseIdentifier(xpp));
4015    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("active")) {
4016      res.setActiveElement(parseBoolean(xpp));
4017    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("morphology")) {
4018      res.setMorphology(parseCodeableConcept(xpp));
4019    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("includedStructure")) {
4020      res.getIncludedStructure().add(parseBodyStructureIncludedStructureComponent(xpp));
4021    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("excludedStructure")) {
4022      res.getExcludedStructure().add(parseBodyStructureExcludedStructureComponent(xpp));
4023    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
4024      res.setDescriptionElement(parseString(xpp));
4025    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("image")) {
4026      res.getImage().add(parseAttachment(xpp));
4027    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
4028      res.setPatient(parseReference(xpp));
4029    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
4030      return false;
4031    }
4032    return true;
4033  }
4034
4035  protected BodyStructure.BodyStructureIncludedStructureComponent parseBodyStructureIncludedStructureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4036    BodyStructure.BodyStructureIncludedStructureComponent res = new BodyStructure.BodyStructureIncludedStructureComponent();
4037    parseElementAttributes(xpp, res);
4038    next(xpp);
4039    int eventType = nextNoWhitespace(xpp);
4040    while (eventType != XmlPullParser.END_TAG) {
4041    if (!parseBodyStructureIncludedStructureComponentContent(eventType, xpp, res))
4042        unknownContent(xpp);
4043      eventType = nextNoWhitespace(xpp);
4044    }
4045    next(xpp);
4046    parseElementClose(res);
4047    return res;
4048  }
4049
4050  protected boolean parseBodyStructureIncludedStructureComponentContent(int eventType, XmlPullParser xpp, BodyStructure.BodyStructureIncludedStructureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4051    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("structure")) {
4052      res.setStructure(parseCodeableConcept(xpp));
4053    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("laterality")) {
4054      res.setLaterality(parseCodeableConcept(xpp));
4055    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualifier")) {
4056      res.getQualifier().add(parseCodeableConcept(xpp));
4057    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4058      return false;
4059    }
4060    return true;
4061  }
4062
4063  protected BodyStructure.BodyStructureExcludedStructureComponent parseBodyStructureExcludedStructureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4064    BodyStructure.BodyStructureExcludedStructureComponent res = new BodyStructure.BodyStructureExcludedStructureComponent();
4065    parseElementAttributes(xpp, res);
4066    next(xpp);
4067    int eventType = nextNoWhitespace(xpp);
4068    while (eventType != XmlPullParser.END_TAG) {
4069    if (!parseBodyStructureExcludedStructureComponentContent(eventType, xpp, res))
4070        unknownContent(xpp);
4071      eventType = nextNoWhitespace(xpp);
4072    }
4073    next(xpp);
4074    parseElementClose(res);
4075    return res;
4076  }
4077
4078  protected boolean parseBodyStructureExcludedStructureComponentContent(int eventType, XmlPullParser xpp, BodyStructure.BodyStructureExcludedStructureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4079    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("structure")) {
4080      res.setStructure(parseCodeableConcept(xpp));
4081    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("laterality")) {
4082      res.setLaterality(parseCodeableConcept(xpp));
4083    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("qualifier")) {
4084      res.getQualifier().add(parseCodeableConcept(xpp));
4085    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4086      return false;
4087    }
4088    return true;
4089  }
4090
4091  protected Bundle parseBundle(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4092    Bundle res = new Bundle();
4093    parseResourceAttributes(xpp, res);
4094    next(xpp);
4095    int eventType = nextNoWhitespace(xpp);
4096    while (eventType != XmlPullParser.END_TAG) {
4097    if (!parseBundleContent(eventType, xpp, res))
4098        unknownContent(xpp);
4099      eventType = nextNoWhitespace(xpp);
4100    }
4101    next(xpp);
4102    parseElementClose(res);
4103    return res;
4104  }
4105
4106  protected boolean parseBundleContent(int eventType, XmlPullParser xpp, Bundle res) throws XmlPullParserException, IOException, FHIRFormatError {
4107    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
4108      res.setIdentifier(parseIdentifier(xpp));
4109    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
4110      res.setTypeElement(parseEnumeration(xpp, Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
4111    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timestamp")) {
4112      res.setTimestampElement(parseInstant(xpp));
4113    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
4114      res.setTotalElement(parseUnsignedInt(xpp));
4115    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
4116      res.getLink().add(parseBundleLinkComponent(xpp));
4117    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entry")) {
4118      res.getEntry().add(parseBundleEntryComponent(xpp));
4119    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("signature")) {
4120      res.setSignature(parseSignature(xpp));
4121    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issues")) {
4122      res.setIssues(parseResourceContained(xpp));
4123    } else if (!parseResourceContent(eventType, xpp, res)){ 
4124      return false;
4125    }
4126    return true;
4127  }
4128
4129  protected Bundle.BundleLinkComponent parseBundleLinkComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4130    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
4131    parseElementAttributes(xpp, res);
4132    next(xpp);
4133    int eventType = nextNoWhitespace(xpp);
4134    while (eventType != XmlPullParser.END_TAG) {
4135    if (!parseBundleLinkComponentContent(eventType, xpp, res))
4136        unknownContent(xpp);
4137      eventType = nextNoWhitespace(xpp);
4138    }
4139    next(xpp);
4140    parseElementClose(res);
4141    return res;
4142  }
4143
4144  protected boolean parseBundleLinkComponentContent(int eventType, XmlPullParser xpp, Bundle.BundleLinkComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4145    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relation")) {
4146      res.setRelationElement(parseEnumeration(xpp, Bundle.LinkRelationTypes.NULL, new Bundle.LinkRelationTypesEnumFactory()));
4147    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
4148      res.setUrlElement(parseUri(xpp));
4149    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4150      return false;
4151    }
4152    return true;
4153  }
4154
4155  protected Bundle.BundleEntryComponent parseBundleEntryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4156    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
4157    parseElementAttributes(xpp, res);
4158    next(xpp);
4159    int eventType = nextNoWhitespace(xpp);
4160    while (eventType != XmlPullParser.END_TAG) {
4161    if (!parseBundleEntryComponentContent(eventType, xpp, res))
4162        unknownContent(xpp);
4163      eventType = nextNoWhitespace(xpp);
4164    }
4165    next(xpp);
4166    parseElementClose(res);
4167    return res;
4168  }
4169
4170  protected boolean parseBundleEntryComponentContent(int eventType, XmlPullParser xpp, Bundle.BundleEntryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4171    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
4172      res.getLink().add(parseBundleLinkComponent(xpp));
4173    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fullUrl")) {
4174      res.setFullUrlElement(parseUri(xpp));
4175    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
4176      res.setResource(parseResourceContained(xpp));
4177    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("search")) {
4178      res.setSearch(parseBundleEntrySearchComponent(xpp));
4179    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
4180      res.setRequest(parseBundleEntryRequestComponent(xpp));
4181    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("response")) {
4182      res.setResponse(parseBundleEntryResponseComponent(xpp));
4183    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4184      return false;
4185    }
4186    return true;
4187  }
4188
4189  protected Bundle.BundleEntrySearchComponent parseBundleEntrySearchComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4190    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
4191    parseElementAttributes(xpp, res);
4192    next(xpp);
4193    int eventType = nextNoWhitespace(xpp);
4194    while (eventType != XmlPullParser.END_TAG) {
4195    if (!parseBundleEntrySearchComponentContent(eventType, xpp, res))
4196        unknownContent(xpp);
4197      eventType = nextNoWhitespace(xpp);
4198    }
4199    next(xpp);
4200    parseElementClose(res);
4201    return res;
4202  }
4203
4204  protected boolean parseBundleEntrySearchComponentContent(int eventType, XmlPullParser xpp, Bundle.BundleEntrySearchComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4205    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
4206      res.setModeElement(parseEnumeration(xpp, Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
4207    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("score")) {
4208      res.setScoreElement(parseDecimal(xpp));
4209    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4210      return false;
4211    }
4212    return true;
4213  }
4214
4215  protected Bundle.BundleEntryRequestComponent parseBundleEntryRequestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4216    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
4217    parseElementAttributes(xpp, res);
4218    next(xpp);
4219    int eventType = nextNoWhitespace(xpp);
4220    while (eventType != XmlPullParser.END_TAG) {
4221    if (!parseBundleEntryRequestComponentContent(eventType, xpp, res))
4222        unknownContent(xpp);
4223      eventType = nextNoWhitespace(xpp);
4224    }
4225    next(xpp);
4226    parseElementClose(res);
4227    return res;
4228  }
4229
4230  protected boolean parseBundleEntryRequestComponentContent(int eventType, XmlPullParser xpp, Bundle.BundleEntryRequestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4231    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("method")) {
4232      res.setMethodElement(parseEnumeration(xpp, Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
4233    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
4234      res.setUrlElement(parseUri(xpp));
4235    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifNoneMatch")) {
4236      res.setIfNoneMatchElement(parseString(xpp));
4237    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifModifiedSince")) {
4238      res.setIfModifiedSinceElement(parseInstant(xpp));
4239    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifMatch")) {
4240      res.setIfMatchElement(parseString(xpp));
4241    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ifNoneExist")) {
4242      res.setIfNoneExistElement(parseString(xpp));
4243    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4244      return false;
4245    }
4246    return true;
4247  }
4248
4249  protected Bundle.BundleEntryResponseComponent parseBundleEntryResponseComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4250    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
4251    parseElementAttributes(xpp, res);
4252    next(xpp);
4253    int eventType = nextNoWhitespace(xpp);
4254    while (eventType != XmlPullParser.END_TAG) {
4255    if (!parseBundleEntryResponseComponentContent(eventType, xpp, res))
4256        unknownContent(xpp);
4257      eventType = nextNoWhitespace(xpp);
4258    }
4259    next(xpp);
4260    parseElementClose(res);
4261    return res;
4262  }
4263
4264  protected boolean parseBundleEntryResponseComponentContent(int eventType, XmlPullParser xpp, Bundle.BundleEntryResponseComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4265    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
4266      res.setStatusElement(parseString(xpp));
4267    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
4268      res.setLocationElement(parseUri(xpp));
4269    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("etag")) {
4270      res.setEtagElement(parseString(xpp));
4271    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastModified")) {
4272      res.setLastModifiedElement(parseInstant(xpp));
4273    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
4274      res.setOutcome(parseResourceContained(xpp));
4275    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4276      return false;
4277    }
4278    return true;
4279  }
4280
4281  protected CapabilityStatement parseCapabilityStatement(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4282    CapabilityStatement res = new CapabilityStatement();
4283    parseResourceAttributes(xpp, res);
4284    next(xpp);
4285    int eventType = nextNoWhitespace(xpp);
4286    while (eventType != XmlPullParser.END_TAG) {
4287    if (!parseCapabilityStatementContent(eventType, xpp, res))
4288        unknownContent(xpp);
4289      eventType = nextNoWhitespace(xpp);
4290    }
4291    next(xpp);
4292    parseElementClose(res);
4293    return res;
4294  }
4295
4296  protected boolean parseCapabilityStatementContent(int eventType, XmlPullParser xpp, CapabilityStatement res) throws XmlPullParserException, IOException, FHIRFormatError {
4297    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
4298      res.setUrlElement(parseUri(xpp));
4299    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
4300      res.setVersionElement(parseString(xpp));
4301    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "versionAlgorithm")) {
4302      res.setVersionAlgorithm(parseType("versionAlgorithm", xpp));
4303    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
4304      res.setNameElement(parseString(xpp));
4305    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
4306      res.setTitleElement(parseString(xpp));
4307    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
4308      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4309    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
4310      res.setExperimentalElement(parseBoolean(xpp));
4311    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
4312      res.setDateElement(parseDateTime(xpp));
4313    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
4314      res.setPublisherElement(parseString(xpp));
4315    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
4316      res.getContact().add(parseContactDetail(xpp));
4317    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
4318      res.setDescriptionElement(parseMarkdown(xpp));
4319    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
4320      res.getUseContext().add(parseUsageContext(xpp));
4321    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
4322      res.getJurisdiction().add(parseCodeableConcept(xpp));
4323    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
4324      res.setPurposeElement(parseMarkdown(xpp));
4325    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
4326      res.setCopyrightElement(parseMarkdown(xpp));
4327    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyrightLabel")) {
4328      res.setCopyrightLabelElement(parseString(xpp));
4329    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
4330      res.setKindElement(parseEnumeration(xpp, Enumerations.CapabilityStatementKind.NULL, new Enumerations.CapabilityStatementKindEnumFactory()));
4331    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiates")) {
4332      res.getInstantiates().add(parseCanonical(xpp));
4333    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("imports")) {
4334      res.getImports().add(parseCanonical(xpp));
4335    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("software")) {
4336      res.setSoftware(parseCapabilityStatementSoftwareComponent(xpp));
4337    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementation")) {
4338      res.setImplementation(parseCapabilityStatementImplementationComponent(xpp));
4339    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirVersion")) {
4340      res.setFhirVersionElement(parseEnumeration(xpp, Enumerations.FHIRVersion.NULL, new Enumerations.FHIRVersionEnumFactory()));
4341    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("format")) {
4342      res.getFormat().add(parseCode(xpp));
4343    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patchFormat")) {
4344      res.getPatchFormat().add(parseCode(xpp));
4345    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("acceptLanguage")) {
4346      res.getAcceptLanguage().add(parseCode(xpp));
4347    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("implementationGuide")) {
4348      res.getImplementationGuide().add(parseCanonical(xpp));
4349    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rest")) {
4350      res.getRest().add(parseCapabilityStatementRestComponent(xpp));
4351    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("messaging")) {
4352      res.getMessaging().add(parseCapabilityStatementMessagingComponent(xpp));
4353    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("document")) {
4354      res.getDocument().add(parseCapabilityStatementDocumentComponent(xpp));
4355    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
4356      return false;
4357    }
4358    return true;
4359  }
4360
4361  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementSoftwareComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4362    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
4363    parseElementAttributes(xpp, res);
4364    next(xpp);
4365    int eventType = nextNoWhitespace(xpp);
4366    while (eventType != XmlPullParser.END_TAG) {
4367    if (!parseCapabilityStatementSoftwareComponentContent(eventType, xpp, res))
4368        unknownContent(xpp);
4369      eventType = nextNoWhitespace(xpp);
4370    }
4371    next(xpp);
4372    parseElementClose(res);
4373    return res;
4374  }
4375
4376  protected boolean parseCapabilityStatementSoftwareComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4377    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
4378      res.setNameElement(parseString(xpp));
4379    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
4380      res.setVersionElement(parseString(xpp));
4381    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("releaseDate")) {
4382      res.setReleaseDateElement(parseDateTime(xpp));
4383    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4384      return false;
4385    }
4386    return true;
4387  }
4388
4389  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementImplementationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4390    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
4391    parseElementAttributes(xpp, res);
4392    next(xpp);
4393    int eventType = nextNoWhitespace(xpp);
4394    while (eventType != XmlPullParser.END_TAG) {
4395    if (!parseCapabilityStatementImplementationComponentContent(eventType, xpp, res))
4396        unknownContent(xpp);
4397      eventType = nextNoWhitespace(xpp);
4398    }
4399    next(xpp);
4400    parseElementClose(res);
4401    return res;
4402  }
4403
4404  protected boolean parseCapabilityStatementImplementationComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementImplementationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4405    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
4406      res.setDescriptionElement(parseString(xpp));
4407    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
4408      res.setUrlElement(parseUrl(xpp));
4409    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian")) {
4410      res.setCustodian(parseReference(xpp));
4411    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4412      return false;
4413    }
4414    return true;
4415  }
4416
4417  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementRestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4418    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
4419    parseElementAttributes(xpp, res);
4420    next(xpp);
4421    int eventType = nextNoWhitespace(xpp);
4422    while (eventType != XmlPullParser.END_TAG) {
4423    if (!parseCapabilityStatementRestComponentContent(eventType, xpp, res))
4424        unknownContent(xpp);
4425      eventType = nextNoWhitespace(xpp);
4426    }
4427    next(xpp);
4428    parseElementClose(res);
4429    return res;
4430  }
4431
4432  protected boolean parseCapabilityStatementRestComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementRestComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4433    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
4434      res.setModeElement(parseEnumeration(xpp, CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
4435    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4436      res.setDocumentationElement(parseMarkdown(xpp));
4437    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("security")) {
4438      res.setSecurity(parseCapabilityStatementRestSecurityComponent(xpp));
4439    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
4440      res.getResource().add(parseCapabilityStatementRestResourceComponent(xpp));
4441    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
4442      res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(xpp));
4443    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
4444      res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(xpp));
4445    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
4446      res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(xpp));
4447    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compartment")) {
4448      res.getCompartment().add(parseCanonical(xpp));
4449    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4450      return false;
4451    }
4452    return true;
4453  }
4454
4455  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementRestSecurityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4456    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
4457    parseElementAttributes(xpp, res);
4458    next(xpp);
4459    int eventType = nextNoWhitespace(xpp);
4460    while (eventType != XmlPullParser.END_TAG) {
4461    if (!parseCapabilityStatementRestSecurityComponentContent(eventType, xpp, res))
4462        unknownContent(xpp);
4463      eventType = nextNoWhitespace(xpp);
4464    }
4465    next(xpp);
4466    parseElementClose(res);
4467    return res;
4468  }
4469
4470  protected boolean parseCapabilityStatementRestSecurityComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4471    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cors")) {
4472      res.setCorsElement(parseBoolean(xpp));
4473    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
4474      res.getService().add(parseCodeableConcept(xpp));
4475    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
4476      res.setDescriptionElement(parseMarkdown(xpp));
4477    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4478      return false;
4479    }
4480    return true;
4481  }
4482
4483  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementRestResourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4484    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
4485    parseElementAttributes(xpp, res);
4486    next(xpp);
4487    int eventType = nextNoWhitespace(xpp);
4488    while (eventType != XmlPullParser.END_TAG) {
4489    if (!parseCapabilityStatementRestResourceComponentContent(eventType, xpp, res))
4490        unknownContent(xpp);
4491      eventType = nextNoWhitespace(xpp);
4492    }
4493    next(xpp);
4494    parseElementClose(res);
4495    return res;
4496  }
4497
4498  protected boolean parseCapabilityStatementRestResourceComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4499    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
4500      res.setTypeElement(parseCode(xpp));
4501    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
4502      res.setProfileElement(parseCanonical(xpp));
4503    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportedProfile")) {
4504      res.getSupportedProfile().add(parseCanonical(xpp));
4505    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4506      res.setDocumentationElement(parseMarkdown(xpp));
4507    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
4508      res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(xpp));
4509    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versioning")) {
4510      res.setVersioningElement(parseEnumeration(xpp, CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
4511    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("readHistory")) {
4512      res.setReadHistoryElement(parseBoolean(xpp));
4513    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("updateCreate")) {
4514      res.setUpdateCreateElement(parseBoolean(xpp));
4515    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalCreate")) {
4516      res.setConditionalCreateElement(parseBoolean(xpp));
4517    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalRead")) {
4518      res.setConditionalReadElement(parseEnumeration(xpp, CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
4519    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalUpdate")) {
4520      res.setConditionalUpdateElement(parseBoolean(xpp));
4521    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalPatch")) {
4522      res.setConditionalPatchElement(parseBoolean(xpp));
4523    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("conditionalDelete")) {
4524      res.setConditionalDeleteElement(parseEnumeration(xpp, CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
4525    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referencePolicy")) {
4526      res.getReferencePolicy().add(parseEnumeration(xpp, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
4527    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchInclude")) {
4528      res.getSearchInclude().add(parseString(xpp));
4529    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchRevInclude")) {
4530      res.getSearchRevInclude().add(parseString(xpp));
4531    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("searchParam")) {
4532      res.getSearchParam().add(parseCapabilityStatementRestResourceSearchParamComponent(xpp));
4533    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) {
4534      res.getOperation().add(parseCapabilityStatementRestResourceOperationComponent(xpp));
4535    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4536      return false;
4537    }
4538    return true;
4539  }
4540
4541  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4542    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
4543    parseElementAttributes(xpp, res);
4544    next(xpp);
4545    int eventType = nextNoWhitespace(xpp);
4546    while (eventType != XmlPullParser.END_TAG) {
4547    if (!parseCapabilityStatementResourceInteractionComponentContent(eventType, xpp, res))
4548        unknownContent(xpp);
4549      eventType = nextNoWhitespace(xpp);
4550    }
4551    next(xpp);
4552    parseElementClose(res);
4553    return res;
4554  }
4555
4556  protected boolean parseCapabilityStatementResourceInteractionComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.ResourceInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4557    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
4558      res.setCodeElement(parseEnumeration(xpp, CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
4559    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4560      res.setDocumentationElement(parseMarkdown(xpp));
4561    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4562      return false;
4563    }
4564    return true;
4565  }
4566
4567  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementRestResourceSearchParamComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4568    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
4569    parseElementAttributes(xpp, res);
4570    next(xpp);
4571    int eventType = nextNoWhitespace(xpp);
4572    while (eventType != XmlPullParser.END_TAG) {
4573    if (!parseCapabilityStatementRestResourceSearchParamComponentContent(eventType, xpp, res))
4574        unknownContent(xpp);
4575      eventType = nextNoWhitespace(xpp);
4576    }
4577    next(xpp);
4578    parseElementClose(res);
4579    return res;
4580  }
4581
4582  protected boolean parseCapabilityStatementRestResourceSearchParamComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4583    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
4584      res.setNameElement(parseString(xpp));
4585    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
4586      res.setDefinitionElement(parseCanonical(xpp));
4587    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
4588      res.setTypeElement(parseEnumeration(xpp, Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
4589    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4590      res.setDocumentationElement(parseMarkdown(xpp));
4591    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4592      return false;
4593    }
4594    return true;
4595  }
4596
4597  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementRestResourceOperationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4598    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
4599    parseElementAttributes(xpp, res);
4600    next(xpp);
4601    int eventType = nextNoWhitespace(xpp);
4602    while (eventType != XmlPullParser.END_TAG) {
4603    if (!parseCapabilityStatementRestResourceOperationComponentContent(eventType, xpp, res))
4604        unknownContent(xpp);
4605      eventType = nextNoWhitespace(xpp);
4606    }
4607    next(xpp);
4608    parseElementClose(res);
4609    return res;
4610  }
4611
4612  protected boolean parseCapabilityStatementRestResourceOperationComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4613    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
4614      res.setNameElement(parseString(xpp));
4615    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
4616      res.setDefinitionElement(parseCanonical(xpp));
4617    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4618      res.setDocumentationElement(parseMarkdown(xpp));
4619    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4620      return false;
4621    }
4622    return true;
4623  }
4624
4625  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4626    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
4627    parseElementAttributes(xpp, res);
4628    next(xpp);
4629    int eventType = nextNoWhitespace(xpp);
4630    while (eventType != XmlPullParser.END_TAG) {
4631    if (!parseCapabilityStatementSystemInteractionComponentContent(eventType, xpp, res))
4632        unknownContent(xpp);
4633      eventType = nextNoWhitespace(xpp);
4634    }
4635    next(xpp);
4636    parseElementClose(res);
4637    return res;
4638  }
4639
4640  protected boolean parseCapabilityStatementSystemInteractionComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.SystemInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4641    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
4642      res.setCodeElement(parseEnumeration(xpp, CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
4643    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4644      res.setDocumentationElement(parseMarkdown(xpp));
4645    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4646      return false;
4647    }
4648    return true;
4649  }
4650
4651  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementMessagingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4652    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
4653    parseElementAttributes(xpp, res);
4654    next(xpp);
4655    int eventType = nextNoWhitespace(xpp);
4656    while (eventType != XmlPullParser.END_TAG) {
4657    if (!parseCapabilityStatementMessagingComponentContent(eventType, xpp, res))
4658        unknownContent(xpp);
4659      eventType = nextNoWhitespace(xpp);
4660    }
4661    next(xpp);
4662    parseElementClose(res);
4663    return res;
4664  }
4665
4666  protected boolean parseCapabilityStatementMessagingComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementMessagingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4667    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endpoint")) {
4668      res.getEndpoint().add(parseCapabilityStatementMessagingEndpointComponent(xpp));
4669    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reliableCache")) {
4670      res.setReliableCacheElement(parseUnsignedInt(xpp));
4671    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4672      res.setDocumentationElement(parseMarkdown(xpp));
4673    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportedMessage")) {
4674      res.getSupportedMessage().add(parseCapabilityStatementMessagingSupportedMessageComponent(xpp));
4675    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4676      return false;
4677    }
4678    return true;
4679  }
4680
4681  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementMessagingEndpointComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4682    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
4683    parseElementAttributes(xpp, res);
4684    next(xpp);
4685    int eventType = nextNoWhitespace(xpp);
4686    while (eventType != XmlPullParser.END_TAG) {
4687    if (!parseCapabilityStatementMessagingEndpointComponentContent(eventType, xpp, res))
4688        unknownContent(xpp);
4689      eventType = nextNoWhitespace(xpp);
4690    }
4691    next(xpp);
4692    parseElementClose(res);
4693    return res;
4694  }
4695
4696  protected boolean parseCapabilityStatementMessagingEndpointComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4697    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocol")) {
4698      res.setProtocol(parseCoding(xpp));
4699    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("address")) {
4700      res.setAddressElement(parseUrl(xpp));
4701    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4702      return false;
4703    }
4704    return true;
4705  }
4706
4707  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementMessagingSupportedMessageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4708    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
4709    parseElementAttributes(xpp, res);
4710    next(xpp);
4711    int eventType = nextNoWhitespace(xpp);
4712    while (eventType != XmlPullParser.END_TAG) {
4713    if (!parseCapabilityStatementMessagingSupportedMessageComponentContent(eventType, xpp, res))
4714        unknownContent(xpp);
4715      eventType = nextNoWhitespace(xpp);
4716    }
4717    next(xpp);
4718    parseElementClose(res);
4719    return res;
4720  }
4721
4722  protected boolean parseCapabilityStatementMessagingSupportedMessageComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4723    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
4724      res.setModeElement(parseEnumeration(xpp, CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
4725    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
4726      res.setDefinitionElement(parseCanonical(xpp));
4727    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4728      return false;
4729    }
4730    return true;
4731  }
4732
4733  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementDocumentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4734    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
4735    parseElementAttributes(xpp, res);
4736    next(xpp);
4737    int eventType = nextNoWhitespace(xpp);
4738    while (eventType != XmlPullParser.END_TAG) {
4739    if (!parseCapabilityStatementDocumentComponentContent(eventType, xpp, res))
4740        unknownContent(xpp);
4741      eventType = nextNoWhitespace(xpp);
4742    }
4743    next(xpp);
4744    parseElementClose(res);
4745    return res;
4746  }
4747
4748  protected boolean parseCapabilityStatementDocumentComponentContent(int eventType, XmlPullParser xpp, CapabilityStatement.CapabilityStatementDocumentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4749    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
4750      res.setModeElement(parseEnumeration(xpp, CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
4751    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
4752      res.setDocumentationElement(parseMarkdown(xpp));
4753    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("profile")) {
4754      res.setProfileElement(parseCanonical(xpp));
4755    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4756      return false;
4757    }
4758    return true;
4759  }
4760
4761  protected CarePlan parseCarePlan(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4762    CarePlan res = new CarePlan();
4763    parseResourceAttributes(xpp, res);
4764    next(xpp);
4765    int eventType = nextNoWhitespace(xpp);
4766    while (eventType != XmlPullParser.END_TAG) {
4767    if (!parseCarePlanContent(eventType, xpp, res))
4768        unknownContent(xpp);
4769      eventType = nextNoWhitespace(xpp);
4770    }
4771    next(xpp);
4772    parseElementClose(res);
4773    return res;
4774  }
4775
4776  protected boolean parseCarePlanContent(int eventType, XmlPullParser xpp, CarePlan res) throws XmlPullParserException, IOException, FHIRFormatError {
4777    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
4778      res.getIdentifier().add(parseIdentifier(xpp));
4779    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesCanonical")) {
4780      res.getInstantiatesCanonical().add(parseCanonical(xpp));
4781    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
4782      res.getInstantiatesUri().add(parseUri(xpp));
4783    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
4784      res.getBasedOn().add(parseReference(xpp));
4785    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
4786      res.getReplaces().add(parseReference(xpp));
4787    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
4788      res.getPartOf().add(parseReference(xpp));
4789    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
4790      res.setStatusElement(parseEnumeration(xpp, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
4791    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
4792      res.setIntentElement(parseEnumeration(xpp, CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4793    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
4794      res.getCategory().add(parseCodeableConcept(xpp));
4795    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
4796      res.setTitleElement(parseString(xpp));
4797    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
4798      res.setDescriptionElement(parseString(xpp));
4799    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
4800      res.setSubject(parseReference(xpp));
4801    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
4802      res.setEncounter(parseReference(xpp));
4803    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
4804      res.setPeriod(parsePeriod(xpp));
4805    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
4806      res.setCreatedElement(parseDateTime(xpp));
4807    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian")) {
4808      res.setCustodian(parseReference(xpp));
4809    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
4810      res.getContributor().add(parseReference(xpp));
4811    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeam")) {
4812      res.getCareTeam().add(parseReference(xpp));
4813    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addresses")) {
4814      res.getAddresses().add(parseCodeableReference(xpp));
4815    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
4816      res.getSupportingInfo().add(parseReference(xpp));
4817    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("goal")) {
4818      res.getGoal().add(parseReference(xpp));
4819    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activity")) {
4820      res.getActivity().add(parseCarePlanActivityComponent(xpp));
4821    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
4822      res.getNote().add(parseAnnotation(xpp));
4823    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
4824      return false;
4825    }
4826    return true;
4827  }
4828
4829  protected CarePlan.CarePlanActivityComponent parseCarePlanActivityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4830    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4831    parseElementAttributes(xpp, res);
4832    next(xpp);
4833    int eventType = nextNoWhitespace(xpp);
4834    while (eventType != XmlPullParser.END_TAG) {
4835    if (!parseCarePlanActivityComponentContent(eventType, xpp, res))
4836        unknownContent(xpp);
4837      eventType = nextNoWhitespace(xpp);
4838    }
4839    next(xpp);
4840    parseElementClose(res);
4841    return res;
4842  }
4843
4844  protected boolean parseCarePlanActivityComponentContent(int eventType, XmlPullParser xpp, CarePlan.CarePlanActivityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4845    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performedActivity")) {
4846      res.getPerformedActivity().add(parseCodeableReference(xpp));
4847    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("progress")) {
4848      res.getProgress().add(parseAnnotation(xpp));
4849    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("plannedActivityReference")) {
4850      res.setPlannedActivityReference(parseReference(xpp));
4851    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("plannedActivityDetail")) {
4852      res.setPlannedActivityDetail(parseCarePlanActivityPlannedActivityDetailComponent(xpp));
4853    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4854      return false;
4855    }
4856    return true;
4857  }
4858
4859  protected CarePlan.CarePlanActivityPlannedActivityDetailComponent parseCarePlanActivityPlannedActivityDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4860    CarePlan.CarePlanActivityPlannedActivityDetailComponent res = new CarePlan.CarePlanActivityPlannedActivityDetailComponent();
4861    parseElementAttributes(xpp, res);
4862    next(xpp);
4863    int eventType = nextNoWhitespace(xpp);
4864    while (eventType != XmlPullParser.END_TAG) {
4865    if (!parseCarePlanActivityPlannedActivityDetailComponentContent(eventType, xpp, res))
4866        unknownContent(xpp);
4867      eventType = nextNoWhitespace(xpp);
4868    }
4869    next(xpp);
4870    parseElementClose(res);
4871    return res;
4872  }
4873
4874  protected boolean parseCarePlanActivityPlannedActivityDetailComponentContent(int eventType, XmlPullParser xpp, CarePlan.CarePlanActivityPlannedActivityDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4875    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("kind")) {
4876      res.setKindElement(parseEnumeration(xpp, CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4877    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesCanonical")) {
4878      res.getInstantiatesCanonical().add(parseCanonical(xpp));
4879    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
4880      res.getInstantiatesUri().add(parseUri(xpp));
4881    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
4882      res.setCode(parseCodeableConcept(xpp));
4883    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
4884      res.getReason().add(parseCodeableReference(xpp));
4885    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("goal")) {
4886      res.getGoal().add(parseReference(xpp));
4887    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
4888      res.setStatusElement(parseEnumeration(xpp, CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4889    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
4890      res.setStatusReason(parseCodeableConcept(xpp));
4891    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
4892      res.setDoNotPerformElement(parseBoolean(xpp));
4893    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "scheduled")) {
4894      res.setScheduled(parseType("scheduled", xpp));
4895    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
4896      res.setLocation(parseCodeableReference(xpp));
4897    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "reported")) {
4898      res.setReported(parseType("reported", xpp));
4899    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
4900      res.getPerformer().add(parseReference(xpp));
4901    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "product")) {
4902      res.setProduct(parseType("product", xpp));
4903    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dailyAmount")) {
4904      res.setDailyAmount(parseQuantity(xpp));
4905    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
4906      res.setQuantity(parseQuantity(xpp));
4907    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
4908      res.setDescriptionElement(parseString(xpp));
4909    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4910      return false;
4911    }
4912    return true;
4913  }
4914
4915  protected CareTeam parseCareTeam(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4916    CareTeam res = new CareTeam();
4917    parseResourceAttributes(xpp, res);
4918    next(xpp);
4919    int eventType = nextNoWhitespace(xpp);
4920    while (eventType != XmlPullParser.END_TAG) {
4921    if (!parseCareTeamContent(eventType, xpp, res))
4922        unknownContent(xpp);
4923      eventType = nextNoWhitespace(xpp);
4924    }
4925    next(xpp);
4926    parseElementClose(res);
4927    return res;
4928  }
4929
4930  protected boolean parseCareTeamContent(int eventType, XmlPullParser xpp, CareTeam res) throws XmlPullParserException, IOException, FHIRFormatError {
4931    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
4932      res.getIdentifier().add(parseIdentifier(xpp));
4933    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
4934      res.setStatusElement(parseEnumeration(xpp, CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4935    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
4936      res.getCategory().add(parseCodeableConcept(xpp));
4937    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
4938      res.setNameElement(parseString(xpp));
4939    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
4940      res.setSubject(parseReference(xpp));
4941    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
4942      res.setPeriod(parsePeriod(xpp));
4943    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
4944      res.getParticipant().add(parseCareTeamParticipantComponent(xpp));
4945    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
4946      res.getReason().add(parseCodeableReference(xpp));
4947    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("managingOrganization")) {
4948      res.getManagingOrganization().add(parseReference(xpp));
4949    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("telecom")) {
4950      res.getTelecom().add(parseContactPoint(xpp));
4951    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
4952      res.getNote().add(parseAnnotation(xpp));
4953    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
4954      return false;
4955    }
4956    return true;
4957  }
4958
4959  protected CareTeam.CareTeamParticipantComponent parseCareTeamParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4960    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4961    parseElementAttributes(xpp, res);
4962    next(xpp);
4963    int eventType = nextNoWhitespace(xpp);
4964    while (eventType != XmlPullParser.END_TAG) {
4965    if (!parseCareTeamParticipantComponentContent(eventType, xpp, res))
4966        unknownContent(xpp);
4967      eventType = nextNoWhitespace(xpp);
4968    }
4969    next(xpp);
4970    parseElementClose(res);
4971    return res;
4972  }
4973
4974  protected boolean parseCareTeamParticipantComponentContent(int eventType, XmlPullParser xpp, CareTeam.CareTeamParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
4975    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
4976      res.setRole(parseCodeableConcept(xpp));
4977    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("member")) {
4978      res.setMember(parseReference(xpp));
4979    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onBehalfOf")) {
4980      res.setOnBehalfOf(parseReference(xpp));
4981    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "coverage")) {
4982      res.setCoverage(parseType("coverage", xpp));
4983    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
4984      return false;
4985    }
4986    return true;
4987  }
4988
4989  protected ChargeItem parseChargeItem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
4990    ChargeItem res = new ChargeItem();
4991    parseResourceAttributes(xpp, res);
4992    next(xpp);
4993    int eventType = nextNoWhitespace(xpp);
4994    while (eventType != XmlPullParser.END_TAG) {
4995    if (!parseChargeItemContent(eventType, xpp, res))
4996        unknownContent(xpp);
4997      eventType = nextNoWhitespace(xpp);
4998    }
4999    next(xpp);
5000    parseElementClose(res);
5001    return res;
5002  }
5003
5004  protected boolean parseChargeItemContent(int eventType, XmlPullParser xpp, ChargeItem res) throws XmlPullParserException, IOException, FHIRFormatError {
5005    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
5006      res.getIdentifier().add(parseIdentifier(xpp));
5007    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definitionUri")) {
5008      res.getDefinitionUri().add(parseUri(xpp));
5009    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definitionCanonical")) {
5010      res.getDefinitionCanonical().add(parseCanonical(xpp));
5011    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
5012      res.setStatusElement(parseEnumeration(xpp, ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
5013    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
5014      res.getPartOf().add(parseReference(xpp));
5015    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
5016      res.setCode(parseCodeableConcept(xpp));
5017    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
5018      res.setSubject(parseReference(xpp));
5019    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
5020      res.setEncounter(parseReference(xpp));
5021    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
5022      res.setOccurrence(parseType("occurrence", xpp));
5023    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
5024      res.getPerformer().add(parseChargeItemPerformerComponent(xpp));
5025    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performingOrganization")) {
5026      res.setPerformingOrganization(parseReference(xpp));
5027    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestingOrganization")) {
5028      res.setRequestingOrganization(parseReference(xpp));
5029    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("costCenter")) {
5030      res.setCostCenter(parseReference(xpp));
5031    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
5032      res.setQuantity(parseQuantity(xpp));
5033    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodysite")) {
5034      res.getBodysite().add(parseCodeableConcept(xpp));
5035    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPriceComponent")) {
5036      res.setUnitPriceComponent(parseMonetaryComponent(xpp));
5037    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("totalPriceComponent")) {
5038      res.setTotalPriceComponent(parseMonetaryComponent(xpp));
5039    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("overrideReason")) {
5040      res.setOverrideReason(parseCodeableConcept(xpp));
5041    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enterer")) {
5042      res.setEnterer(parseReference(xpp));
5043    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enteredDate")) {
5044      res.setEnteredDateElement(parseDateTime(xpp));
5045    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
5046      res.getReason().add(parseCodeableConcept(xpp));
5047    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("service")) {
5048      res.getService().add(parseCodeableReference(xpp));
5049    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("product")) {
5050      res.getProduct().add(parseCodeableReference(xpp));
5051    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("account")) {
5052      res.getAccount().add(parseReference(xpp));
5053    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
5054      res.getNote().add(parseAnnotation(xpp));
5055    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInformation")) {
5056      res.getSupportingInformation().add(parseReference(xpp));
5057    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
5058      return false;
5059    }
5060    return true;
5061  }
5062
5063  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemPerformerComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5064    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
5065    parseElementAttributes(xpp, res);
5066    next(xpp);
5067    int eventType = nextNoWhitespace(xpp);
5068    while (eventType != XmlPullParser.END_TAG) {
5069    if (!parseChargeItemPerformerComponentContent(eventType, xpp, res))
5070        unknownContent(xpp);
5071      eventType = nextNoWhitespace(xpp);
5072    }
5073    next(xpp);
5074    parseElementClose(res);
5075    return res;
5076  }
5077
5078  protected boolean parseChargeItemPerformerComponentContent(int eventType, XmlPullParser xpp, ChargeItem.ChargeItemPerformerComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5079    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
5080      res.setFunction(parseCodeableConcept(xpp));
5081    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
5082      res.setActor(parseReference(xpp));
5083    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5084      return false;
5085    }
5086    return true;
5087  }
5088
5089  protected ChargeItemDefinition parseChargeItemDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5090    ChargeItemDefinition res = new ChargeItemDefinition();
5091    parseResourceAttributes(xpp, res);
5092    next(xpp);
5093    int eventType = nextNoWhitespace(xpp);
5094    while (eventType != XmlPullParser.END_TAG) {
5095    if (!parseChargeItemDefinitionContent(eventType, xpp, res))
5096        unknownContent(xpp);
5097      eventType = nextNoWhitespace(xpp);
5098    }
5099    next(xpp);
5100    parseElementClose(res);
5101    return res;
5102  }
5103
5104  protected boolean parseChargeItemDefinitionContent(int eventType, XmlPullParser xpp, ChargeItemDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
5105    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
5106      res.setUrlElement(parseUri(xpp));
5107    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
5108      res.getIdentifier().add(parseIdentifier(xpp));
5109    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
5110      res.setVersionElement(parseString(xpp));
5111    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
5112      res.setNameElement(parseString(xpp));
5113    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
5114      res.setTitleElement(parseString(xpp));
5115    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("derivedFromUri")) {
5116      res.getDerivedFromUri().add(parseUri(xpp));
5117    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
5118      res.getPartOf().add(parseCanonical(xpp));
5119    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
5120      res.getReplaces().add(parseCanonical(xpp));
5121    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
5122      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5123    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
5124      res.setExperimentalElement(parseBoolean(xpp));
5125    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
5126      res.setDateElement(parseDateTime(xpp));
5127    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
5128      res.setPublisherElement(parseString(xpp));
5129    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
5130      res.getContact().add(parseContactDetail(xpp));
5131    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
5132      res.setDescriptionElement(parseMarkdown(xpp));
5133    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
5134      res.getUseContext().add(parseUsageContext(xpp));
5135    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
5136      res.getJurisdiction().add(parseCodeableConcept(xpp));
5137    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
5138      res.setPurposeElement(parseMarkdown(xpp));
5139    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
5140      res.setCopyrightElement(parseMarkdown(xpp));
5141    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
5142      res.setApprovalDateElement(parseDate(xpp));
5143    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
5144      res.setLastReviewDateElement(parseDate(xpp));
5145    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
5146      res.setCode(parseCodeableConcept(xpp));
5147    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instance")) {
5148      res.getInstance().add(parseReference(xpp));
5149    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("applicability")) {
5150      res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(xpp));
5151    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("propertyGroup")) {
5152      res.getPropertyGroup().add(parseChargeItemDefinitionPropertyGroupComponent(xpp));
5153    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
5154      return false;
5155    }
5156    return true;
5157  }
5158
5159  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionApplicabilityComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5160    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
5161    parseElementAttributes(xpp, res);
5162    next(xpp);
5163    int eventType = nextNoWhitespace(xpp);
5164    while (eventType != XmlPullParser.END_TAG) {
5165    if (!parseChargeItemDefinitionApplicabilityComponentContent(eventType, xpp, res))
5166        unknownContent(xpp);
5167      eventType = nextNoWhitespace(xpp);
5168    }
5169    next(xpp);
5170    parseElementClose(res);
5171    return res;
5172  }
5173
5174  protected boolean parseChargeItemDefinitionApplicabilityComponentContent(int eventType, XmlPullParser xpp, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5175    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("condition")) {
5176      res.setCondition(parseExpression(xpp));
5177    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
5178      res.setEffectivePeriod(parsePeriod(xpp));
5179    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
5180      res.setRelatedArtifact(parseRelatedArtifact(xpp));
5181    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5182      return false;
5183    }
5184    return true;
5185  }
5186
5187  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionPropertyGroupComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5188    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
5189    parseElementAttributes(xpp, res);
5190    next(xpp);
5191    int eventType = nextNoWhitespace(xpp);
5192    while (eventType != XmlPullParser.END_TAG) {
5193    if (!parseChargeItemDefinitionPropertyGroupComponentContent(eventType, xpp, res))
5194        unknownContent(xpp);
5195      eventType = nextNoWhitespace(xpp);
5196    }
5197    next(xpp);
5198    parseElementClose(res);
5199    return res;
5200  }
5201
5202  protected boolean parseChargeItemDefinitionPropertyGroupComponentContent(int eventType, XmlPullParser xpp, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5203    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("applicability")) {
5204      res.getApplicability().add(parseChargeItemDefinitionApplicabilityComponent(xpp));
5205    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priceComponent")) {
5206      res.getPriceComponent().add(parseMonetaryComponent(xpp));
5207    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5208      return false;
5209    }
5210    return true;
5211  }
5212
5213  protected Citation parseCitation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5214    Citation res = new Citation();
5215    parseResourceAttributes(xpp, res);
5216    next(xpp);
5217    int eventType = nextNoWhitespace(xpp);
5218    while (eventType != XmlPullParser.END_TAG) {
5219    if (!parseCitationContent(eventType, xpp, res))
5220        unknownContent(xpp);
5221      eventType = nextNoWhitespace(xpp);
5222    }
5223    next(xpp);
5224    parseElementClose(res);
5225    return res;
5226  }
5227
5228  protected boolean parseCitationContent(int eventType, XmlPullParser xpp, Citation res) throws XmlPullParserException, IOException, FHIRFormatError {
5229    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
5230      res.setUrlElement(parseUri(xpp));
5231    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
5232      res.getIdentifier().add(parseIdentifier(xpp));
5233    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
5234      res.setVersionElement(parseString(xpp));
5235    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
5236      res.setNameElement(parseString(xpp));
5237    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
5238      res.setTitleElement(parseString(xpp));
5239    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
5240      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
5241    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
5242      res.setExperimentalElement(parseBoolean(xpp));
5243    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
5244      res.setDateElement(parseDateTime(xpp));
5245    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
5246      res.setPublisherElement(parseString(xpp));
5247    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
5248      res.getContact().add(parseContactDetail(xpp));
5249    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
5250      res.setDescriptionElement(parseMarkdown(xpp));
5251    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
5252      res.getUseContext().add(parseUsageContext(xpp));
5253    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
5254      res.getJurisdiction().add(parseCodeableConcept(xpp));
5255    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
5256      res.setPurposeElement(parseMarkdown(xpp));
5257    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
5258      res.setCopyrightElement(parseMarkdown(xpp));
5259    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
5260      res.setApprovalDateElement(parseDate(xpp));
5261    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
5262      res.setLastReviewDateElement(parseDate(xpp));
5263    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
5264      res.setEffectivePeriod(parsePeriod(xpp));
5265    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
5266      res.getAuthor().add(parseContactDetail(xpp));
5267    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
5268      res.getEditor().add(parseContactDetail(xpp));
5269    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
5270      res.getReviewer().add(parseContactDetail(xpp));
5271    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
5272      res.getEndorser().add(parseContactDetail(xpp));
5273    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
5274      res.getSummary().add(parseCitationSummaryComponent(xpp));
5275    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
5276      res.getClassification().add(parseCitationClassificationComponent(xpp));
5277    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
5278      res.getNote().add(parseAnnotation(xpp));
5279    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("currentState")) {
5280      res.getCurrentState().add(parseCodeableConcept(xpp));
5281    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusDate")) {
5282      res.getStatusDate().add(parseCitationStatusDateComponent(xpp));
5283    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
5284      res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
5285    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citedArtifact")) {
5286      res.setCitedArtifact(parseCitationCitedArtifactComponent(xpp));
5287    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
5288      return false;
5289    }
5290    return true;
5291  }
5292
5293  protected Citation.CitationSummaryComponent parseCitationSummaryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5294    Citation.CitationSummaryComponent res = new Citation.CitationSummaryComponent();
5295    parseElementAttributes(xpp, res);
5296    next(xpp);
5297    int eventType = nextNoWhitespace(xpp);
5298    while (eventType != XmlPullParser.END_TAG) {
5299    if (!parseCitationSummaryComponentContent(eventType, xpp, res))
5300        unknownContent(xpp);
5301      eventType = nextNoWhitespace(xpp);
5302    }
5303    next(xpp);
5304    parseElementClose(res);
5305    return res;
5306  }
5307
5308  protected boolean parseCitationSummaryComponentContent(int eventType, XmlPullParser xpp, Citation.CitationSummaryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5309    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("style")) {
5310      res.setStyle(parseCodeableConcept(xpp));
5311    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
5312      res.setTextElement(parseMarkdown(xpp));
5313    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5314      return false;
5315    }
5316    return true;
5317  }
5318
5319  protected Citation.CitationClassificationComponent parseCitationClassificationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5320    Citation.CitationClassificationComponent res = new Citation.CitationClassificationComponent();
5321    parseElementAttributes(xpp, res);
5322    next(xpp);
5323    int eventType = nextNoWhitespace(xpp);
5324    while (eventType != XmlPullParser.END_TAG) {
5325    if (!parseCitationClassificationComponentContent(eventType, xpp, res))
5326        unknownContent(xpp);
5327      eventType = nextNoWhitespace(xpp);
5328    }
5329    next(xpp);
5330    parseElementClose(res);
5331    return res;
5332  }
5333
5334  protected boolean parseCitationClassificationComponentContent(int eventType, XmlPullParser xpp, Citation.CitationClassificationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5335    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5336      res.setType(parseCodeableConcept(xpp));
5337    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classifier")) {
5338      res.getClassifier().add(parseCodeableConcept(xpp));
5339    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5340      return false;
5341    }
5342    return true;
5343  }
5344
5345  protected Citation.CitationStatusDateComponent parseCitationStatusDateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5346    Citation.CitationStatusDateComponent res = new Citation.CitationStatusDateComponent();
5347    parseElementAttributes(xpp, res);
5348    next(xpp);
5349    int eventType = nextNoWhitespace(xpp);
5350    while (eventType != XmlPullParser.END_TAG) {
5351    if (!parseCitationStatusDateComponentContent(eventType, xpp, res))
5352        unknownContent(xpp);
5353      eventType = nextNoWhitespace(xpp);
5354    }
5355    next(xpp);
5356    parseElementClose(res);
5357    return res;
5358  }
5359
5360  protected boolean parseCitationStatusDateComponentContent(int eventType, XmlPullParser xpp, Citation.CitationStatusDateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5361    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activity")) {
5362      res.setActivity(parseCodeableConcept(xpp));
5363    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actual")) {
5364      res.setActualElement(parseBoolean(xpp));
5365    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
5366      res.setPeriod(parsePeriod(xpp));
5367    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5368      return false;
5369    }
5370    return true;
5371  }
5372
5373  protected Citation.CitationCitedArtifactComponent parseCitationCitedArtifactComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5374    Citation.CitationCitedArtifactComponent res = new Citation.CitationCitedArtifactComponent();
5375    parseElementAttributes(xpp, res);
5376    next(xpp);
5377    int eventType = nextNoWhitespace(xpp);
5378    while (eventType != XmlPullParser.END_TAG) {
5379    if (!parseCitationCitedArtifactComponentContent(eventType, xpp, res))
5380        unknownContent(xpp);
5381      eventType = nextNoWhitespace(xpp);
5382    }
5383    next(xpp);
5384    parseElementClose(res);
5385    return res;
5386  }
5387
5388  protected boolean parseCitationCitedArtifactComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5389    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
5390      res.getIdentifier().add(parseIdentifier(xpp));
5391    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedIdentifier")) {
5392      res.getRelatedIdentifier().add(parseIdentifier(xpp));
5393    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateAccessed")) {
5394      res.setDateAccessedElement(parseDateTime(xpp));
5395    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
5396      res.setVersion(parseCitationCitedArtifactVersionComponent(xpp));
5397    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("currentState")) {
5398      res.getCurrentState().add(parseCodeableConcept(xpp));
5399    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusDate")) {
5400      res.getStatusDate().add(parseCitationCitedArtifactStatusDateComponent(xpp));
5401    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
5402      res.getTitle().add(parseCitationCitedArtifactTitleComponent(xpp));
5403    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("abstract")) {
5404      res.getAbstract().add(parseCitationCitedArtifactAbstractComponent(xpp));
5405    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("part")) {
5406      res.setPart(parseCitationCitedArtifactPartComponent(xpp));
5407    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatesTo")) {
5408      res.getRelatesTo().add(parseCitationCitedArtifactRelatesToComponent(xpp));
5409    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationForm")) {
5410      res.getPublicationForm().add(parseCitationCitedArtifactPublicationFormComponent(xpp));
5411    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("webLocation")) {
5412      res.getWebLocation().add(parseCitationCitedArtifactWebLocationComponent(xpp));
5413    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
5414      res.getClassification().add(parseCitationCitedArtifactClassificationComponent(xpp));
5415    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributorship")) {
5416      res.setContributorship(parseCitationCitedArtifactContributorshipComponent(xpp));
5417    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
5418      res.getNote().add(parseAnnotation(xpp));
5419    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5420      return false;
5421    }
5422    return true;
5423  }
5424
5425  protected Citation.CitationCitedArtifactVersionComponent parseCitationCitedArtifactVersionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5426    Citation.CitationCitedArtifactVersionComponent res = new Citation.CitationCitedArtifactVersionComponent();
5427    parseElementAttributes(xpp, res);
5428    next(xpp);
5429    int eventType = nextNoWhitespace(xpp);
5430    while (eventType != XmlPullParser.END_TAG) {
5431    if (!parseCitationCitedArtifactVersionComponentContent(eventType, xpp, res))
5432        unknownContent(xpp);
5433      eventType = nextNoWhitespace(xpp);
5434    }
5435    next(xpp);
5436    parseElementClose(res);
5437    return res;
5438  }
5439
5440  protected boolean parseCitationCitedArtifactVersionComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactVersionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5441    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
5442      res.setValueElement(parseString(xpp));
5443    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("baseCitation")) {
5444      res.setBaseCitation(parseReference(xpp));
5445    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5446      return false;
5447    }
5448    return true;
5449  }
5450
5451  protected Citation.CitationCitedArtifactStatusDateComponent parseCitationCitedArtifactStatusDateComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5452    Citation.CitationCitedArtifactStatusDateComponent res = new Citation.CitationCitedArtifactStatusDateComponent();
5453    parseElementAttributes(xpp, res);
5454    next(xpp);
5455    int eventType = nextNoWhitespace(xpp);
5456    while (eventType != XmlPullParser.END_TAG) {
5457    if (!parseCitationCitedArtifactStatusDateComponentContent(eventType, xpp, res))
5458        unknownContent(xpp);
5459      eventType = nextNoWhitespace(xpp);
5460    }
5461    next(xpp);
5462    parseElementClose(res);
5463    return res;
5464  }
5465
5466  protected boolean parseCitationCitedArtifactStatusDateComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactStatusDateComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5467    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activity")) {
5468      res.setActivity(parseCodeableConcept(xpp));
5469    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actual")) {
5470      res.setActualElement(parseBoolean(xpp));
5471    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
5472      res.setPeriod(parsePeriod(xpp));
5473    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5474      return false;
5475    }
5476    return true;
5477  }
5478
5479  protected Citation.CitationCitedArtifactTitleComponent parseCitationCitedArtifactTitleComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5480    Citation.CitationCitedArtifactTitleComponent res = new Citation.CitationCitedArtifactTitleComponent();
5481    parseElementAttributes(xpp, res);
5482    next(xpp);
5483    int eventType = nextNoWhitespace(xpp);
5484    while (eventType != XmlPullParser.END_TAG) {
5485    if (!parseCitationCitedArtifactTitleComponentContent(eventType, xpp, res))
5486        unknownContent(xpp);
5487      eventType = nextNoWhitespace(xpp);
5488    }
5489    next(xpp);
5490    parseElementClose(res);
5491    return res;
5492  }
5493
5494  protected boolean parseCitationCitedArtifactTitleComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactTitleComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5495    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5496      res.getType().add(parseCodeableConcept(xpp));
5497    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
5498      res.setLanguage(parseCodeableConcept(xpp));
5499    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
5500      res.setTextElement(parseMarkdown(xpp));
5501    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5502      return false;
5503    }
5504    return true;
5505  }
5506
5507  protected Citation.CitationCitedArtifactAbstractComponent parseCitationCitedArtifactAbstractComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5508    Citation.CitationCitedArtifactAbstractComponent res = new Citation.CitationCitedArtifactAbstractComponent();
5509    parseElementAttributes(xpp, res);
5510    next(xpp);
5511    int eventType = nextNoWhitespace(xpp);
5512    while (eventType != XmlPullParser.END_TAG) {
5513    if (!parseCitationCitedArtifactAbstractComponentContent(eventType, xpp, res))
5514        unknownContent(xpp);
5515      eventType = nextNoWhitespace(xpp);
5516    }
5517    next(xpp);
5518    parseElementClose(res);
5519    return res;
5520  }
5521
5522  protected boolean parseCitationCitedArtifactAbstractComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactAbstractComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5523    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5524      res.setType(parseCodeableConcept(xpp));
5525    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
5526      res.setLanguage(parseCodeableConcept(xpp));
5527    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
5528      res.setTextElement(parseMarkdown(xpp));
5529    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
5530      res.setCopyrightElement(parseMarkdown(xpp));
5531    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5532      return false;
5533    }
5534    return true;
5535  }
5536
5537  protected Citation.CitationCitedArtifactPartComponent parseCitationCitedArtifactPartComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5538    Citation.CitationCitedArtifactPartComponent res = new Citation.CitationCitedArtifactPartComponent();
5539    parseElementAttributes(xpp, res);
5540    next(xpp);
5541    int eventType = nextNoWhitespace(xpp);
5542    while (eventType != XmlPullParser.END_TAG) {
5543    if (!parseCitationCitedArtifactPartComponentContent(eventType, xpp, res))
5544        unknownContent(xpp);
5545      eventType = nextNoWhitespace(xpp);
5546    }
5547    next(xpp);
5548    parseElementClose(res);
5549    return res;
5550  }
5551
5552  protected boolean parseCitationCitedArtifactPartComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactPartComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5553    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5554      res.setType(parseCodeableConcept(xpp));
5555    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
5556      res.setValueElement(parseString(xpp));
5557    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("baseCitation")) {
5558      res.setBaseCitation(parseReference(xpp));
5559    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5560      return false;
5561    }
5562    return true;
5563  }
5564
5565  protected Citation.CitationCitedArtifactRelatesToComponent parseCitationCitedArtifactRelatesToComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5566    Citation.CitationCitedArtifactRelatesToComponent res = new Citation.CitationCitedArtifactRelatesToComponent();
5567    parseElementAttributes(xpp, res);
5568    next(xpp);
5569    int eventType = nextNoWhitespace(xpp);
5570    while (eventType != XmlPullParser.END_TAG) {
5571    if (!parseCitationCitedArtifactRelatesToComponentContent(eventType, xpp, res))
5572        unknownContent(xpp);
5573      eventType = nextNoWhitespace(xpp);
5574    }
5575    next(xpp);
5576    parseElementClose(res);
5577    return res;
5578  }
5579
5580  protected boolean parseCitationCitedArtifactRelatesToComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactRelatesToComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5581    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5582      res.setTypeElement(parseEnumeration(xpp, Citation.RelatedArtifactTypeExpanded.NULL, new Citation.RelatedArtifactTypeExpandedEnumFactory()));
5583    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classifier")) {
5584      res.getClassifier().add(parseCodeableConcept(xpp));
5585    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
5586      res.setLabelElement(parseString(xpp));
5587    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
5588      res.setDisplayElement(parseString(xpp));
5589    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citation")) {
5590      res.setCitationElement(parseMarkdown(xpp));
5591    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("document")) {
5592      res.setDocument(parseAttachment(xpp));
5593    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
5594      res.setResourceElement(parseCanonical(xpp));
5595    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceReference")) {
5596      res.setResourceReference(parseReference(xpp));
5597    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5598      return false;
5599    }
5600    return true;
5601  }
5602
5603  protected Citation.CitationCitedArtifactPublicationFormComponent parseCitationCitedArtifactPublicationFormComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5604    Citation.CitationCitedArtifactPublicationFormComponent res = new Citation.CitationCitedArtifactPublicationFormComponent();
5605    parseElementAttributes(xpp, res);
5606    next(xpp);
5607    int eventType = nextNoWhitespace(xpp);
5608    while (eventType != XmlPullParser.END_TAG) {
5609    if (!parseCitationCitedArtifactPublicationFormComponentContent(eventType, xpp, res))
5610        unknownContent(xpp);
5611      eventType = nextNoWhitespace(xpp);
5612    }
5613    next(xpp);
5614    parseElementClose(res);
5615    return res;
5616  }
5617
5618  protected boolean parseCitationCitedArtifactPublicationFormComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactPublicationFormComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5619    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publishedIn")) {
5620      res.setPublishedIn(parseCitationCitedArtifactPublicationFormPublishedInComponent(xpp));
5621    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("citedMedium")) {
5622      res.setCitedMedium(parseCodeableConcept(xpp));
5623    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("volume")) {
5624      res.setVolumeElement(parseString(xpp));
5625    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issue")) {
5626      res.setIssueElement(parseString(xpp));
5627    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDateYear")) {
5628      res.setPublicationDateYearElement(parseString(xpp));
5629    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDateMonth")) {
5630      res.setPublicationDateMonthElement(parseString(xpp));
5631    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDateDay")) {
5632      res.setPublicationDateDayElement(parseString(xpp));
5633    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDateSeason")) {
5634      res.setPublicationDateSeasonElement(parseString(xpp));
5635    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publicationDateText")) {
5636      res.setPublicationDateTextElement(parseString(xpp));
5637    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("articleDate")) {
5638      res.setArticleDateElement(parseDateTime(xpp));
5639    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastRevisionDate")) {
5640      res.setLastRevisionDateElement(parseDateTime(xpp));
5641    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
5642      res.getLanguage().add(parseCodeableConcept(xpp));
5643    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accessionNumber")) {
5644      res.setAccessionNumberElement(parseString(xpp));
5645    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pageString")) {
5646      res.setPageStringElement(parseString(xpp));
5647    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("firstPage")) {
5648      res.setFirstPageElement(parseString(xpp));
5649    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastPage")) {
5650      res.setLastPageElement(parseString(xpp));
5651    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("pageCount")) {
5652      res.setPageCountElement(parseString(xpp));
5653    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
5654      res.setCopyrightElement(parseMarkdown(xpp));
5655    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5656      return false;
5657    }
5658    return true;
5659  }
5660
5661  protected Citation.CitationCitedArtifactPublicationFormPublishedInComponent parseCitationCitedArtifactPublicationFormPublishedInComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5662    Citation.CitationCitedArtifactPublicationFormPublishedInComponent res = new Citation.CitationCitedArtifactPublicationFormPublishedInComponent();
5663    parseElementAttributes(xpp, res);
5664    next(xpp);
5665    int eventType = nextNoWhitespace(xpp);
5666    while (eventType != XmlPullParser.END_TAG) {
5667    if (!parseCitationCitedArtifactPublicationFormPublishedInComponentContent(eventType, xpp, res))
5668        unknownContent(xpp);
5669      eventType = nextNoWhitespace(xpp);
5670    }
5671    next(xpp);
5672    parseElementClose(res);
5673    return res;
5674  }
5675
5676  protected boolean parseCitationCitedArtifactPublicationFormPublishedInComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactPublicationFormPublishedInComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5677    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5678      res.setType(parseCodeableConcept(xpp));
5679    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
5680      res.getIdentifier().add(parseIdentifier(xpp));
5681    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
5682      res.setTitleElement(parseString(xpp));
5683    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
5684      res.setPublisher(parseReference(xpp));
5685    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisherLocation")) {
5686      res.setPublisherLocationElement(parseString(xpp));
5687    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5688      return false;
5689    }
5690    return true;
5691  }
5692
5693  protected Citation.CitationCitedArtifactWebLocationComponent parseCitationCitedArtifactWebLocationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5694    Citation.CitationCitedArtifactWebLocationComponent res = new Citation.CitationCitedArtifactWebLocationComponent();
5695    parseElementAttributes(xpp, res);
5696    next(xpp);
5697    int eventType = nextNoWhitespace(xpp);
5698    while (eventType != XmlPullParser.END_TAG) {
5699    if (!parseCitationCitedArtifactWebLocationComponentContent(eventType, xpp, res))
5700        unknownContent(xpp);
5701      eventType = nextNoWhitespace(xpp);
5702    }
5703    next(xpp);
5704    parseElementClose(res);
5705    return res;
5706  }
5707
5708  protected boolean parseCitationCitedArtifactWebLocationComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactWebLocationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5709    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classifier")) {
5710      res.getClassifier().add(parseCodeableConcept(xpp));
5711    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
5712      res.setUrlElement(parseUri(xpp));
5713    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5714      return false;
5715    }
5716    return true;
5717  }
5718
5719  protected Citation.CitationCitedArtifactClassificationComponent parseCitationCitedArtifactClassificationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5720    Citation.CitationCitedArtifactClassificationComponent res = new Citation.CitationCitedArtifactClassificationComponent();
5721    parseElementAttributes(xpp, res);
5722    next(xpp);
5723    int eventType = nextNoWhitespace(xpp);
5724    while (eventType != XmlPullParser.END_TAG) {
5725    if (!parseCitationCitedArtifactClassificationComponentContent(eventType, xpp, res))
5726        unknownContent(xpp);
5727      eventType = nextNoWhitespace(xpp);
5728    }
5729    next(xpp);
5730    parseElementClose(res);
5731    return res;
5732  }
5733
5734  protected boolean parseCitationCitedArtifactClassificationComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactClassificationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5735    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5736      res.setType(parseCodeableConcept(xpp));
5737    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classifier")) {
5738      res.getClassifier().add(parseCodeableConcept(xpp));
5739    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("artifactAssessment")) {
5740      res.getArtifactAssessment().add(parseReference(xpp));
5741    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5742      return false;
5743    }
5744    return true;
5745  }
5746
5747  protected Citation.CitationCitedArtifactContributorshipComponent parseCitationCitedArtifactContributorshipComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5748    Citation.CitationCitedArtifactContributorshipComponent res = new Citation.CitationCitedArtifactContributorshipComponent();
5749    parseElementAttributes(xpp, res);
5750    next(xpp);
5751    int eventType = nextNoWhitespace(xpp);
5752    while (eventType != XmlPullParser.END_TAG) {
5753    if (!parseCitationCitedArtifactContributorshipComponentContent(eventType, xpp, res))
5754        unknownContent(xpp);
5755      eventType = nextNoWhitespace(xpp);
5756    }
5757    next(xpp);
5758    parseElementClose(res);
5759    return res;
5760  }
5761
5762  protected boolean parseCitationCitedArtifactContributorshipComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactContributorshipComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5763    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("complete")) {
5764      res.setCompleteElement(parseBoolean(xpp));
5765    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entry")) {
5766      res.getEntry().add(parseCitationCitedArtifactContributorshipEntryComponent(xpp));
5767    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
5768      res.getSummary().add(parseCitationContributorshipSummaryComponent(xpp));
5769    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5770      return false;
5771    }
5772    return true;
5773  }
5774
5775  protected Citation.CitationCitedArtifactContributorshipEntryComponent parseCitationCitedArtifactContributorshipEntryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5776    Citation.CitationCitedArtifactContributorshipEntryComponent res = new Citation.CitationCitedArtifactContributorshipEntryComponent();
5777    parseElementAttributes(xpp, res);
5778    next(xpp);
5779    int eventType = nextNoWhitespace(xpp);
5780    while (eventType != XmlPullParser.END_TAG) {
5781    if (!parseCitationCitedArtifactContributorshipEntryComponentContent(eventType, xpp, res))
5782        unknownContent(xpp);
5783      eventType = nextNoWhitespace(xpp);
5784    }
5785    next(xpp);
5786    parseElementClose(res);
5787    return res;
5788  }
5789
5790  protected boolean parseCitationCitedArtifactContributorshipEntryComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactContributorshipEntryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5791    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributor")) {
5792      res.setContributor(parseReference(xpp));
5793    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("forenameInitials")) {
5794      res.setForenameInitialsElement(parseString(xpp));
5795    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("affiliation")) {
5796      res.getAffiliation().add(parseReference(xpp));
5797    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributionType")) {
5798      res.getContributionType().add(parseCodeableConcept(xpp));
5799    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
5800      res.setRole(parseCodeableConcept(xpp));
5801    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributionInstance")) {
5802      res.getContributionInstance().add(parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(xpp));
5803    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("correspondingContact")) {
5804      res.setCorrespondingContactElement(parseBoolean(xpp));
5805    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rankingOrder")) {
5806      res.setRankingOrderElement(parsePositiveInt(xpp));
5807    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5808      return false;
5809    }
5810    return true;
5811  }
5812
5813  protected Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent parseCitationCitedArtifactContributorshipEntryContributionInstanceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5814    Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res = new Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent();
5815    parseElementAttributes(xpp, res);
5816    next(xpp);
5817    int eventType = nextNoWhitespace(xpp);
5818    while (eventType != XmlPullParser.END_TAG) {
5819    if (!parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentContent(eventType, xpp, res))
5820        unknownContent(xpp);
5821      eventType = nextNoWhitespace(xpp);
5822    }
5823    next(xpp);
5824    parseElementClose(res);
5825    return res;
5826  }
5827
5828  protected boolean parseCitationCitedArtifactContributorshipEntryContributionInstanceComponentContent(int eventType, XmlPullParser xpp, Citation.CitationCitedArtifactContributorshipEntryContributionInstanceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5829    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5830      res.setType(parseCodeableConcept(xpp));
5831    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
5832      res.setTimeElement(parseDateTime(xpp));
5833    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5834      return false;
5835    }
5836    return true;
5837  }
5838
5839  protected Citation.ContributorshipSummaryComponent parseCitationContributorshipSummaryComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5840    Citation.ContributorshipSummaryComponent res = new Citation.ContributorshipSummaryComponent();
5841    parseElementAttributes(xpp, res);
5842    next(xpp);
5843    int eventType = nextNoWhitespace(xpp);
5844    while (eventType != XmlPullParser.END_TAG) {
5845    if (!parseCitationContributorshipSummaryComponentContent(eventType, xpp, res))
5846        unknownContent(xpp);
5847      eventType = nextNoWhitespace(xpp);
5848    }
5849    next(xpp);
5850    parseElementClose(res);
5851    return res;
5852  }
5853
5854  protected boolean parseCitationContributorshipSummaryComponentContent(int eventType, XmlPullParser xpp, Citation.ContributorshipSummaryComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5855    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5856      res.setType(parseCodeableConcept(xpp));
5857    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("style")) {
5858      res.setStyle(parseCodeableConcept(xpp));
5859    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
5860      res.setSource(parseCodeableConcept(xpp));
5861    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
5862      res.setValueElement(parseMarkdown(xpp));
5863    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5864      return false;
5865    }
5866    return true;
5867  }
5868
5869  protected Claim parseClaim(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5870    Claim res = new Claim();
5871    parseResourceAttributes(xpp, res);
5872    next(xpp);
5873    int eventType = nextNoWhitespace(xpp);
5874    while (eventType != XmlPullParser.END_TAG) {
5875    if (!parseClaimContent(eventType, xpp, res))
5876        unknownContent(xpp);
5877      eventType = nextNoWhitespace(xpp);
5878    }
5879    next(xpp);
5880    parseElementClose(res);
5881    return res;
5882  }
5883
5884  protected boolean parseClaimContent(int eventType, XmlPullParser xpp, Claim res) throws XmlPullParserException, IOException, FHIRFormatError {
5885    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
5886      res.getIdentifier().add(parseIdentifier(xpp));
5887    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
5888      res.setStatusElement(parseEnumeration(xpp, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
5889    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5890      res.setType(parseCodeableConcept(xpp));
5891    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subType")) {
5892      res.setSubType(parseCodeableConcept(xpp));
5893    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
5894      res.setUseElement(parseEnumeration(xpp, Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
5895    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
5896      res.setPatient(parseReference(xpp));
5897    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("billablePeriod")) {
5898      res.setBillablePeriod(parsePeriod(xpp));
5899    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
5900      res.setCreatedElement(parseDateTime(xpp));
5901    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("enterer")) {
5902      res.setEnterer(parseReference(xpp));
5903    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
5904      res.setInsurer(parseReference(xpp));
5905    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
5906      res.setProvider(parseReference(xpp));
5907    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
5908      res.setPriority(parseCodeableConcept(xpp));
5909    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fundsReserve")) {
5910      res.setFundsReserve(parseCodeableConcept(xpp));
5911    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("related")) {
5912      res.getRelated().add(parseClaimRelatedClaimComponent(xpp));
5913    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prescription")) {
5914      res.setPrescription(parseReference(xpp));
5915    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("originalPrescription")) {
5916      res.setOriginalPrescription(parseReference(xpp));
5917    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payee")) {
5918      res.setPayee(parseClaimPayeeComponent(xpp));
5919    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("referral")) {
5920      res.setReferral(parseReference(xpp));
5921    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
5922      res.getEncounter().add(parseReference(xpp));
5923    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("facility")) {
5924      res.setFacility(parseReference(xpp));
5925    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosisRelatedGroup")) {
5926      res.setDiagnosisRelatedGroup(parseCodeableConcept(xpp));
5927    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeam")) {
5928      res.getCareTeam().add(parseClaimCareTeamComponent(xpp));
5929    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
5930      res.getSupportingInfo().add(parseClaimSupportingInformationComponent(xpp));
5931    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosis")) {
5932      res.getDiagnosis().add(parseClaimDiagnosisComponent(xpp));
5933    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedure")) {
5934      res.getProcedure().add(parseClaimProcedureComponent(xpp));
5935    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
5936      res.getInsurance().add(parseClaimInsuranceComponent(xpp));
5937    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accident")) {
5938      res.setAccident(parseClaimAccidentComponent(xpp));
5939    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientPaid")) {
5940      res.setPatientPaid(parseMoney(xpp));
5941    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
5942      res.getItem().add(parseClaimItemComponent(xpp));
5943    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
5944      res.setTotal(parseMoney(xpp));
5945    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
5946      return false;
5947    }
5948    return true;
5949  }
5950
5951  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5952    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
5953    parseElementAttributes(xpp, res);
5954    next(xpp);
5955    int eventType = nextNoWhitespace(xpp);
5956    while (eventType != XmlPullParser.END_TAG) {
5957    if (!parseClaimRelatedClaimComponentContent(eventType, xpp, res))
5958        unknownContent(xpp);
5959      eventType = nextNoWhitespace(xpp);
5960    }
5961    next(xpp);
5962    parseElementClose(res);
5963    return res;
5964  }
5965
5966  protected boolean parseClaimRelatedClaimComponentContent(int eventType, XmlPullParser xpp, Claim.RelatedClaimComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5967    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claim")) {
5968      res.setClaim(parseReference(xpp));
5969    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
5970      res.setRelationship(parseCodeableConcept(xpp));
5971    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
5972      res.setReference(parseIdentifier(xpp));
5973    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
5974      return false;
5975    }
5976    return true;
5977  }
5978
5979  protected Claim.PayeeComponent parseClaimPayeeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
5980    Claim.PayeeComponent res = new Claim.PayeeComponent();
5981    parseElementAttributes(xpp, res);
5982    next(xpp);
5983    int eventType = nextNoWhitespace(xpp);
5984    while (eventType != XmlPullParser.END_TAG) {
5985    if (!parseClaimPayeeComponentContent(eventType, xpp, res))
5986        unknownContent(xpp);
5987      eventType = nextNoWhitespace(xpp);
5988    }
5989    next(xpp);
5990    parseElementClose(res);
5991    return res;
5992  }
5993
5994  protected boolean parseClaimPayeeComponentContent(int eventType, XmlPullParser xpp, Claim.PayeeComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
5995    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
5996      res.setType(parseCodeableConcept(xpp));
5997    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
5998      res.setParty(parseReference(xpp));
5999    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6000      return false;
6001    }
6002    return true;
6003  }
6004
6005  protected Claim.CareTeamComponent parseClaimCareTeamComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6006    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
6007    parseElementAttributes(xpp, res);
6008    next(xpp);
6009    int eventType = nextNoWhitespace(xpp);
6010    while (eventType != XmlPullParser.END_TAG) {
6011    if (!parseClaimCareTeamComponentContent(eventType, xpp, res))
6012        unknownContent(xpp);
6013      eventType = nextNoWhitespace(xpp);
6014    }
6015    next(xpp);
6016    parseElementClose(res);
6017    return res;
6018  }
6019
6020  protected boolean parseClaimCareTeamComponentContent(int eventType, XmlPullParser xpp, Claim.CareTeamComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6021    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6022      res.setSequenceElement(parsePositiveInt(xpp));
6023    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
6024      res.setProvider(parseReference(xpp));
6025    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("responsible")) {
6026      res.setResponsibleElement(parseBoolean(xpp));
6027    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
6028      res.setRole(parseCodeableConcept(xpp));
6029    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("specialty")) {
6030      res.setSpecialty(parseCodeableConcept(xpp));
6031    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6032      return false;
6033    }
6034    return true;
6035  }
6036
6037  protected Claim.SupportingInformationComponent parseClaimSupportingInformationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6038    Claim.SupportingInformationComponent res = new Claim.SupportingInformationComponent();
6039    parseElementAttributes(xpp, res);
6040    next(xpp);
6041    int eventType = nextNoWhitespace(xpp);
6042    while (eventType != XmlPullParser.END_TAG) {
6043    if (!parseClaimSupportingInformationComponentContent(eventType, xpp, res))
6044        unknownContent(xpp);
6045      eventType = nextNoWhitespace(xpp);
6046    }
6047    next(xpp);
6048    parseElementClose(res);
6049    return res;
6050  }
6051
6052  protected boolean parseClaimSupportingInformationComponentContent(int eventType, XmlPullParser xpp, Claim.SupportingInformationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6053    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6054      res.setSequenceElement(parsePositiveInt(xpp));
6055    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
6056      res.setCategory(parseCodeableConcept(xpp));
6057    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
6058      res.setCode(parseCodeableConcept(xpp));
6059    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "timing")) {
6060      res.setTiming(parseType("timing", xpp));
6061    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
6062      res.setValue(parseType("value", xpp));
6063    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
6064      res.setReason(parseCodeableConcept(xpp));
6065    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6066      return false;
6067    }
6068    return true;
6069  }
6070
6071  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6072    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
6073    parseElementAttributes(xpp, res);
6074    next(xpp);
6075    int eventType = nextNoWhitespace(xpp);
6076    while (eventType != XmlPullParser.END_TAG) {
6077    if (!parseClaimDiagnosisComponentContent(eventType, xpp, res))
6078        unknownContent(xpp);
6079      eventType = nextNoWhitespace(xpp);
6080    }
6081    next(xpp);
6082    parseElementClose(res);
6083    return res;
6084  }
6085
6086  protected boolean parseClaimDiagnosisComponentContent(int eventType, XmlPullParser xpp, Claim.DiagnosisComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6087    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6088      res.setSequenceElement(parsePositiveInt(xpp));
6089    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "diagnosis")) {
6090      res.setDiagnosis(parseType("diagnosis", xpp));
6091    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
6092      res.getType().add(parseCodeableConcept(xpp));
6093    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("onAdmission")) {
6094      res.setOnAdmission(parseCodeableConcept(xpp));
6095    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6096      return false;
6097    }
6098    return true;
6099  }
6100
6101  protected Claim.ProcedureComponent parseClaimProcedureComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6102    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
6103    parseElementAttributes(xpp, res);
6104    next(xpp);
6105    int eventType = nextNoWhitespace(xpp);
6106    while (eventType != XmlPullParser.END_TAG) {
6107    if (!parseClaimProcedureComponentContent(eventType, xpp, res))
6108        unknownContent(xpp);
6109      eventType = nextNoWhitespace(xpp);
6110    }
6111    next(xpp);
6112    parseElementClose(res);
6113    return res;
6114  }
6115
6116  protected boolean parseClaimProcedureComponentContent(int eventType, XmlPullParser xpp, Claim.ProcedureComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6117    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6118      res.setSequenceElement(parsePositiveInt(xpp));
6119    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
6120      res.getType().add(parseCodeableConcept(xpp));
6121    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
6122      res.setDateElement(parseDateTime(xpp));
6123    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "procedure")) {
6124      res.setProcedure(parseType("procedure", xpp));
6125    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
6126      res.getUdi().add(parseReference(xpp));
6127    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6128      return false;
6129    }
6130    return true;
6131  }
6132
6133  protected Claim.InsuranceComponent parseClaimInsuranceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6134    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
6135    parseElementAttributes(xpp, res);
6136    next(xpp);
6137    int eventType = nextNoWhitespace(xpp);
6138    while (eventType != XmlPullParser.END_TAG) {
6139    if (!parseClaimInsuranceComponentContent(eventType, xpp, res))
6140        unknownContent(xpp);
6141      eventType = nextNoWhitespace(xpp);
6142    }
6143    next(xpp);
6144    parseElementClose(res);
6145    return res;
6146  }
6147
6148  protected boolean parseClaimInsuranceComponentContent(int eventType, XmlPullParser xpp, Claim.InsuranceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6149    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6150      res.setSequenceElement(parsePositiveInt(xpp));
6151    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focal")) {
6152      res.setFocalElement(parseBoolean(xpp));
6153    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
6154      res.setIdentifier(parseIdentifier(xpp));
6155    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
6156      res.setCoverage(parseReference(xpp));
6157    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("businessArrangement")) {
6158      res.setBusinessArrangementElement(parseString(xpp));
6159    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthRef")) {
6160      res.getPreAuthRef().add(parseString(xpp));
6161    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claimResponse")) {
6162      res.setClaimResponse(parseReference(xpp));
6163    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6164      return false;
6165    }
6166    return true;
6167  }
6168
6169  protected Claim.AccidentComponent parseClaimAccidentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6170    Claim.AccidentComponent res = new Claim.AccidentComponent();
6171    parseElementAttributes(xpp, res);
6172    next(xpp);
6173    int eventType = nextNoWhitespace(xpp);
6174    while (eventType != XmlPullParser.END_TAG) {
6175    if (!parseClaimAccidentComponentContent(eventType, xpp, res))
6176        unknownContent(xpp);
6177      eventType = nextNoWhitespace(xpp);
6178    }
6179    next(xpp);
6180    parseElementClose(res);
6181    return res;
6182  }
6183
6184  protected boolean parseClaimAccidentComponentContent(int eventType, XmlPullParser xpp, Claim.AccidentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6185    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
6186      res.setDateElement(parseDate(xpp));
6187    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
6188      res.setType(parseCodeableConcept(xpp));
6189    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "location")) {
6190      res.setLocation(parseType("location", xpp));
6191    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6192      return false;
6193    }
6194    return true;
6195  }
6196
6197  protected Claim.ItemComponent parseClaimItemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6198    Claim.ItemComponent res = new Claim.ItemComponent();
6199    parseElementAttributes(xpp, res);
6200    next(xpp);
6201    int eventType = nextNoWhitespace(xpp);
6202    while (eventType != XmlPullParser.END_TAG) {
6203    if (!parseClaimItemComponentContent(eventType, xpp, res))
6204        unknownContent(xpp);
6205      eventType = nextNoWhitespace(xpp);
6206    }
6207    next(xpp);
6208    parseElementClose(res);
6209    return res;
6210  }
6211
6212  protected boolean parseClaimItemComponentContent(int eventType, XmlPullParser xpp, Claim.ItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6213    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6214      res.setSequenceElement(parsePositiveInt(xpp));
6215    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careTeamSequence")) {
6216      res.getCareTeamSequence().add(parsePositiveInt(xpp));
6217    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosisSequence")) {
6218      res.getDiagnosisSequence().add(parsePositiveInt(xpp));
6219    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("procedureSequence")) {
6220      res.getProcedureSequence().add(parsePositiveInt(xpp));
6221    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationSequence")) {
6222      res.getInformationSequence().add(parsePositiveInt(xpp));
6223    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
6224      res.setRevenue(parseCodeableConcept(xpp));
6225    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
6226      res.setCategory(parseCodeableConcept(xpp));
6227    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
6228      res.setProductOrService(parseCodeableConcept(xpp));
6229    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrServiceEnd")) {
6230      res.setProductOrServiceEnd(parseCodeableConcept(xpp));
6231    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
6232      res.getModifier().add(parseCodeableConcept(xpp));
6233    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
6234      res.getProgramCode().add(parseCodeableConcept(xpp));
6235    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "serviced")) {
6236      res.setServiced(parseType("serviced", xpp));
6237    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "location")) {
6238      res.setLocation(parseType("location", xpp));
6239    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientPaid")) {
6240      res.setPatientPaid(parseMoney(xpp));
6241    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
6242      res.setQuantity(parseQuantity(xpp));
6243    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
6244      res.setUnitPrice(parseMoney(xpp));
6245    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
6246      res.setFactorElement(parseDecimal(xpp));
6247    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tax")) {
6248      res.setTax(parseMoney(xpp));
6249    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
6250      res.setNet(parseMoney(xpp));
6251    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
6252      res.getUdi().add(parseReference(xpp));
6253    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
6254      res.getBodySite().add(parseClaimBodySiteComponent(xpp));
6255    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
6256      res.getEncounter().add(parseReference(xpp));
6257    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
6258      res.getDetail().add(parseClaimDetailComponent(xpp));
6259    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6260      return false;
6261    }
6262    return true;
6263  }
6264
6265  protected Claim.BodySiteComponent parseClaimBodySiteComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6266    Claim.BodySiteComponent res = new Claim.BodySiteComponent();
6267    parseElementAttributes(xpp, res);
6268    next(xpp);
6269    int eventType = nextNoWhitespace(xpp);
6270    while (eventType != XmlPullParser.END_TAG) {
6271    if (!parseClaimBodySiteComponentContent(eventType, xpp, res))
6272        unknownContent(xpp);
6273      eventType = nextNoWhitespace(xpp);
6274    }
6275    next(xpp);
6276    parseElementClose(res);
6277    return res;
6278  }
6279
6280  protected boolean parseClaimBodySiteComponentContent(int eventType, XmlPullParser xpp, Claim.BodySiteComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6281    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
6282      res.getSite().add(parseCodeableReference(xpp));
6283    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subSite")) {
6284      res.getSubSite().add(parseCodeableConcept(xpp));
6285    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6286      return false;
6287    }
6288    return true;
6289  }
6290
6291  protected Claim.DetailComponent parseClaimDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6292    Claim.DetailComponent res = new Claim.DetailComponent();
6293    parseElementAttributes(xpp, res);
6294    next(xpp);
6295    int eventType = nextNoWhitespace(xpp);
6296    while (eventType != XmlPullParser.END_TAG) {
6297    if (!parseClaimDetailComponentContent(eventType, xpp, res))
6298        unknownContent(xpp);
6299      eventType = nextNoWhitespace(xpp);
6300    }
6301    next(xpp);
6302    parseElementClose(res);
6303    return res;
6304  }
6305
6306  protected boolean parseClaimDetailComponentContent(int eventType, XmlPullParser xpp, Claim.DetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6307    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6308      res.setSequenceElement(parsePositiveInt(xpp));
6309    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
6310      res.setRevenue(parseCodeableConcept(xpp));
6311    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
6312      res.setCategory(parseCodeableConcept(xpp));
6313    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
6314      res.setProductOrService(parseCodeableConcept(xpp));
6315    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrServiceEnd")) {
6316      res.setProductOrServiceEnd(parseCodeableConcept(xpp));
6317    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
6318      res.getModifier().add(parseCodeableConcept(xpp));
6319    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
6320      res.getProgramCode().add(parseCodeableConcept(xpp));
6321    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientPaid")) {
6322      res.setPatientPaid(parseMoney(xpp));
6323    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
6324      res.setQuantity(parseQuantity(xpp));
6325    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
6326      res.setUnitPrice(parseMoney(xpp));
6327    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
6328      res.setFactorElement(parseDecimal(xpp));
6329    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tax")) {
6330      res.setTax(parseMoney(xpp));
6331    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
6332      res.setNet(parseMoney(xpp));
6333    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
6334      res.getUdi().add(parseReference(xpp));
6335    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
6336      res.getSubDetail().add(parseClaimSubDetailComponent(xpp));
6337    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6338      return false;
6339    }
6340    return true;
6341  }
6342
6343  protected Claim.SubDetailComponent parseClaimSubDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6344    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
6345    parseElementAttributes(xpp, res);
6346    next(xpp);
6347    int eventType = nextNoWhitespace(xpp);
6348    while (eventType != XmlPullParser.END_TAG) {
6349    if (!parseClaimSubDetailComponentContent(eventType, xpp, res))
6350        unknownContent(xpp);
6351      eventType = nextNoWhitespace(xpp);
6352    }
6353    next(xpp);
6354    parseElementClose(res);
6355    return res;
6356  }
6357
6358  protected boolean parseClaimSubDetailComponentContent(int eventType, XmlPullParser xpp, Claim.SubDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6359    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6360      res.setSequenceElement(parsePositiveInt(xpp));
6361    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
6362      res.setRevenue(parseCodeableConcept(xpp));
6363    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
6364      res.setCategory(parseCodeableConcept(xpp));
6365    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
6366      res.setProductOrService(parseCodeableConcept(xpp));
6367    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrServiceEnd")) {
6368      res.setProductOrServiceEnd(parseCodeableConcept(xpp));
6369    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
6370      res.getModifier().add(parseCodeableConcept(xpp));
6371    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
6372      res.getProgramCode().add(parseCodeableConcept(xpp));
6373    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientPaid")) {
6374      res.setPatientPaid(parseMoney(xpp));
6375    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
6376      res.setQuantity(parseQuantity(xpp));
6377    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
6378      res.setUnitPrice(parseMoney(xpp));
6379    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
6380      res.setFactorElement(parseDecimal(xpp));
6381    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tax")) {
6382      res.setTax(parseMoney(xpp));
6383    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
6384      res.setNet(parseMoney(xpp));
6385    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("udi")) {
6386      res.getUdi().add(parseReference(xpp));
6387    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6388      return false;
6389    }
6390    return true;
6391  }
6392
6393  protected ClaimResponse parseClaimResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6394    ClaimResponse res = new ClaimResponse();
6395    parseResourceAttributes(xpp, res);
6396    next(xpp);
6397    int eventType = nextNoWhitespace(xpp);
6398    while (eventType != XmlPullParser.END_TAG) {
6399    if (!parseClaimResponseContent(eventType, xpp, res))
6400        unknownContent(xpp);
6401      eventType = nextNoWhitespace(xpp);
6402    }
6403    next(xpp);
6404    parseElementClose(res);
6405    return res;
6406  }
6407
6408  protected boolean parseClaimResponseContent(int eventType, XmlPullParser xpp, ClaimResponse res) throws XmlPullParserException, IOException, FHIRFormatError {
6409    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
6410      res.getIdentifier().add(parseIdentifier(xpp));
6411    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
6412      res.setStatusElement(parseEnumeration(xpp, Enumerations.FinancialResourceStatusCodes.NULL, new Enumerations.FinancialResourceStatusCodesEnumFactory()));
6413    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
6414      res.setType(parseCodeableConcept(xpp));
6415    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subType")) {
6416      res.setSubType(parseCodeableConcept(xpp));
6417    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
6418      res.setUseElement(parseEnumeration(xpp, Enumerations.Use.NULL, new Enumerations.UseEnumFactory()));
6419    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) {
6420      res.setPatient(parseReference(xpp));
6421    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("created")) {
6422      res.setCreatedElement(parseDateTime(xpp));
6423    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurer")) {
6424      res.setInsurer(parseReference(xpp));
6425    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requestor")) {
6426      res.setRequestor(parseReference(xpp));
6427    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("request")) {
6428      res.setRequest(parseReference(xpp));
6429    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("outcome")) {
6430      res.setOutcomeElement(parseEnumeration(xpp, Enumerations.ClaimProcessingCodes.NULL, new Enumerations.ClaimProcessingCodesEnumFactory()));
6431    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decision")) {
6432      res.setDecision(parseCodeableConcept(xpp));
6433    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("disposition")) {
6434      res.setDispositionElement(parseString(xpp));
6435    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthRef")) {
6436      res.setPreAuthRefElement(parseString(xpp));
6437    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preAuthPeriod")) {
6438      res.setPreAuthPeriod(parsePeriod(xpp));
6439    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payeeType")) {
6440      res.setPayeeType(parseCodeableConcept(xpp));
6441    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
6442      res.getEncounter().add(parseReference(xpp));
6443    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diagnosisRelatedGroup")) {
6444      res.setDiagnosisRelatedGroup(parseCodeableConcept(xpp));
6445    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
6446      res.getItem().add(parseClaimResponseItemComponent(xpp));
6447    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addItem")) {
6448      res.getAddItem().add(parseClaimResponseAddedItemComponent(xpp));
6449    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
6450      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
6451    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("total")) {
6452      res.getTotal().add(parseClaimResponseTotalComponent(xpp));
6453    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payment")) {
6454      res.setPayment(parseClaimResponsePaymentComponent(xpp));
6455    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fundsReserve")) {
6456      res.setFundsReserve(parseCodeableConcept(xpp));
6457    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("formCode")) {
6458      res.setFormCode(parseCodeableConcept(xpp));
6459    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("form")) {
6460      res.setForm(parseAttachment(xpp));
6461    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("processNote")) {
6462      res.getProcessNote().add(parseClaimResponseNoteComponent(xpp));
6463    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("communicationRequest")) {
6464      res.getCommunicationRequest().add(parseReference(xpp));
6465    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("insurance")) {
6466      res.getInsurance().add(parseClaimResponseInsuranceComponent(xpp));
6467    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("error")) {
6468      res.getError().add(parseClaimResponseErrorComponent(xpp));
6469    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
6470      return false;
6471    }
6472    return true;
6473  }
6474
6475  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6476    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
6477    parseElementAttributes(xpp, res);
6478    next(xpp);
6479    int eventType = nextNoWhitespace(xpp);
6480    while (eventType != XmlPullParser.END_TAG) {
6481    if (!parseClaimResponseItemComponentContent(eventType, xpp, res))
6482        unknownContent(xpp);
6483      eventType = nextNoWhitespace(xpp);
6484    }
6485    next(xpp);
6486    parseElementClose(res);
6487    return res;
6488  }
6489
6490  protected boolean parseClaimResponseItemComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.ItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6491    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("itemSequence")) {
6492      res.setItemSequenceElement(parsePositiveInt(xpp));
6493    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
6494      res.getNoteNumber().add(parsePositiveInt(xpp));
6495    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decision")) {
6496      res.setDecision(parseCodeableConcept(xpp));
6497    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
6498      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
6499    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
6500      res.getDetail().add(parseClaimResponseItemDetailComponent(xpp));
6501    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6502      return false;
6503    }
6504    return true;
6505  }
6506
6507  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6508    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
6509    parseElementAttributes(xpp, res);
6510    next(xpp);
6511    int eventType = nextNoWhitespace(xpp);
6512    while (eventType != XmlPullParser.END_TAG) {
6513    if (!parseClaimResponseAdjudicationComponentContent(eventType, xpp, res))
6514        unknownContent(xpp);
6515      eventType = nextNoWhitespace(xpp);
6516    }
6517    next(xpp);
6518    parseElementClose(res);
6519    return res;
6520  }
6521
6522  protected boolean parseClaimResponseAdjudicationComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.AdjudicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6523    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
6524      res.setCategory(parseCodeableConcept(xpp));
6525    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
6526      res.setReason(parseCodeableConcept(xpp));
6527    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
6528      res.setAmount(parseMoney(xpp));
6529    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
6530      res.setValueElement(parseDecimal(xpp));
6531    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6532      return false;
6533    }
6534    return true;
6535  }
6536
6537  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6538    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
6539    parseElementAttributes(xpp, res);
6540    next(xpp);
6541    int eventType = nextNoWhitespace(xpp);
6542    while (eventType != XmlPullParser.END_TAG) {
6543    if (!parseClaimResponseItemDetailComponentContent(eventType, xpp, res))
6544        unknownContent(xpp);
6545      eventType = nextNoWhitespace(xpp);
6546    }
6547    next(xpp);
6548    parseElementClose(res);
6549    return res;
6550  }
6551
6552  protected boolean parseClaimResponseItemDetailComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.ItemDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6553    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detailSequence")) {
6554      res.setDetailSequenceElement(parsePositiveInt(xpp));
6555    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
6556      res.getNoteNumber().add(parsePositiveInt(xpp));
6557    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decision")) {
6558      res.setDecision(parseCodeableConcept(xpp));
6559    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
6560      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
6561    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
6562      res.getSubDetail().add(parseClaimResponseSubDetailComponent(xpp));
6563    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6564      return false;
6565    }
6566    return true;
6567  }
6568
6569  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6570    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
6571    parseElementAttributes(xpp, res);
6572    next(xpp);
6573    int eventType = nextNoWhitespace(xpp);
6574    while (eventType != XmlPullParser.END_TAG) {
6575    if (!parseClaimResponseSubDetailComponentContent(eventType, xpp, res))
6576        unknownContent(xpp);
6577      eventType = nextNoWhitespace(xpp);
6578    }
6579    next(xpp);
6580    parseElementClose(res);
6581    return res;
6582  }
6583
6584  protected boolean parseClaimResponseSubDetailComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.SubDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6585    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetailSequence")) {
6586      res.setSubDetailSequenceElement(parsePositiveInt(xpp));
6587    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
6588      res.getNoteNumber().add(parsePositiveInt(xpp));
6589    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decision")) {
6590      res.setDecision(parseCodeableConcept(xpp));
6591    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
6592      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
6593    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6594      return false;
6595    }
6596    return true;
6597  }
6598
6599  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6600    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
6601    parseElementAttributes(xpp, res);
6602    next(xpp);
6603    int eventType = nextNoWhitespace(xpp);
6604    while (eventType != XmlPullParser.END_TAG) {
6605    if (!parseClaimResponseAddedItemComponentContent(eventType, xpp, res))
6606        unknownContent(xpp);
6607      eventType = nextNoWhitespace(xpp);
6608    }
6609    next(xpp);
6610    parseElementClose(res);
6611    return res;
6612  }
6613
6614  protected boolean parseClaimResponseAddedItemComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.AddedItemComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6615    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("itemSequence")) {
6616      res.getItemSequence().add(parsePositiveInt(xpp));
6617    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detailSequence")) {
6618      res.getDetailSequence().add(parsePositiveInt(xpp));
6619    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subdetailSequence")) {
6620      res.getSubdetailSequence().add(parsePositiveInt(xpp));
6621    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
6622      res.getProvider().add(parseReference(xpp));
6623    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
6624      res.setRevenue(parseCodeableConcept(xpp));
6625    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
6626      res.setProductOrService(parseCodeableConcept(xpp));
6627    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrServiceEnd")) {
6628      res.setProductOrServiceEnd(parseCodeableConcept(xpp));
6629    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
6630      res.getModifier().add(parseCodeableConcept(xpp));
6631    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("programCode")) {
6632      res.getProgramCode().add(parseCodeableConcept(xpp));
6633    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "serviced")) {
6634      res.setServiced(parseType("serviced", xpp));
6635    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "location")) {
6636      res.setLocation(parseType("location", xpp));
6637    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
6638      res.setQuantity(parseQuantity(xpp));
6639    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
6640      res.setUnitPrice(parseMoney(xpp));
6641    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
6642      res.setFactorElement(parseDecimal(xpp));
6643    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tax")) {
6644      res.setTax(parseMoney(xpp));
6645    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
6646      res.setNet(parseMoney(xpp));
6647    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
6648      res.getBodySite().add(parseClaimResponseBodySiteComponent(xpp));
6649    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
6650      res.getNoteNumber().add(parsePositiveInt(xpp));
6651    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decision")) {
6652      res.setDecision(parseCodeableConcept(xpp));
6653    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
6654      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
6655    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
6656      res.getDetail().add(parseClaimResponseAddedItemDetailComponent(xpp));
6657    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6658      return false;
6659    }
6660    return true;
6661  }
6662
6663  protected ClaimResponse.BodySiteComponent parseClaimResponseBodySiteComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6664    ClaimResponse.BodySiteComponent res = new ClaimResponse.BodySiteComponent();
6665    parseElementAttributes(xpp, res);
6666    next(xpp);
6667    int eventType = nextNoWhitespace(xpp);
6668    while (eventType != XmlPullParser.END_TAG) {
6669    if (!parseClaimResponseBodySiteComponentContent(eventType, xpp, res))
6670        unknownContent(xpp);
6671      eventType = nextNoWhitespace(xpp);
6672    }
6673    next(xpp);
6674    parseElementClose(res);
6675    return res;
6676  }
6677
6678  protected boolean parseClaimResponseBodySiteComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.BodySiteComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6679    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("site")) {
6680      res.getSite().add(parseCodeableReference(xpp));
6681    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subSite")) {
6682      res.getSubSite().add(parseCodeableConcept(xpp));
6683    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6684      return false;
6685    }
6686    return true;
6687  }
6688
6689  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6690    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
6691    parseElementAttributes(xpp, res);
6692    next(xpp);
6693    int eventType = nextNoWhitespace(xpp);
6694    while (eventType != XmlPullParser.END_TAG) {
6695    if (!parseClaimResponseAddedItemDetailComponentContent(eventType, xpp, res))
6696        unknownContent(xpp);
6697      eventType = nextNoWhitespace(xpp);
6698    }
6699    next(xpp);
6700    parseElementClose(res);
6701    return res;
6702  }
6703
6704  protected boolean parseClaimResponseAddedItemDetailComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.AddedItemDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6705    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
6706      res.setRevenue(parseCodeableConcept(xpp));
6707    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
6708      res.setProductOrService(parseCodeableConcept(xpp));
6709    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrServiceEnd")) {
6710      res.setProductOrServiceEnd(parseCodeableConcept(xpp));
6711    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
6712      res.getModifier().add(parseCodeableConcept(xpp));
6713    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
6714      res.setQuantity(parseQuantity(xpp));
6715    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
6716      res.setUnitPrice(parseMoney(xpp));
6717    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
6718      res.setFactorElement(parseDecimal(xpp));
6719    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tax")) {
6720      res.setTax(parseMoney(xpp));
6721    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
6722      res.setNet(parseMoney(xpp));
6723    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
6724      res.getNoteNumber().add(parsePositiveInt(xpp));
6725    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decision")) {
6726      res.setDecision(parseCodeableConcept(xpp));
6727    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
6728      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
6729    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetail")) {
6730      res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(xpp));
6731    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6732      return false;
6733    }
6734    return true;
6735  }
6736
6737  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6738    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
6739    parseElementAttributes(xpp, res);
6740    next(xpp);
6741    int eventType = nextNoWhitespace(xpp);
6742    while (eventType != XmlPullParser.END_TAG) {
6743    if (!parseClaimResponseAddedItemSubDetailComponentContent(eventType, xpp, res))
6744        unknownContent(xpp);
6745      eventType = nextNoWhitespace(xpp);
6746    }
6747    next(xpp);
6748    parseElementClose(res);
6749    return res;
6750  }
6751
6752  protected boolean parseClaimResponseAddedItemSubDetailComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.AddedItemSubDetailComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6753    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revenue")) {
6754      res.setRevenue(parseCodeableConcept(xpp));
6755    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrService")) {
6756      res.setProductOrService(parseCodeableConcept(xpp));
6757    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("productOrServiceEnd")) {
6758      res.setProductOrServiceEnd(parseCodeableConcept(xpp));
6759    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("modifier")) {
6760      res.getModifier().add(parseCodeableConcept(xpp));
6761    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("quantity")) {
6762      res.setQuantity(parseQuantity(xpp));
6763    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unitPrice")) {
6764      res.setUnitPrice(parseMoney(xpp));
6765    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("factor")) {
6766      res.setFactorElement(parseDecimal(xpp));
6767    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tax")) {
6768      res.setTax(parseMoney(xpp));
6769    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("net")) {
6770      res.setNet(parseMoney(xpp));
6771    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noteNumber")) {
6772      res.getNoteNumber().add(parsePositiveInt(xpp));
6773    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("decision")) {
6774      res.setDecision(parseCodeableConcept(xpp));
6775    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjudication")) {
6776      res.getAdjudication().add(parseClaimResponseAdjudicationComponent(xpp));
6777    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6778      return false;
6779    }
6780    return true;
6781  }
6782
6783  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6784    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
6785    parseElementAttributes(xpp, res);
6786    next(xpp);
6787    int eventType = nextNoWhitespace(xpp);
6788    while (eventType != XmlPullParser.END_TAG) {
6789    if (!parseClaimResponseTotalComponentContent(eventType, xpp, res))
6790        unknownContent(xpp);
6791      eventType = nextNoWhitespace(xpp);
6792    }
6793    next(xpp);
6794    parseElementClose(res);
6795    return res;
6796  }
6797
6798  protected boolean parseClaimResponseTotalComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.TotalComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6799    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
6800      res.setCategory(parseCodeableConcept(xpp));
6801    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
6802      res.setAmount(parseMoney(xpp));
6803    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6804      return false;
6805    }
6806    return true;
6807  }
6808
6809  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6810    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
6811    parseElementAttributes(xpp, res);
6812    next(xpp);
6813    int eventType = nextNoWhitespace(xpp);
6814    while (eventType != XmlPullParser.END_TAG) {
6815    if (!parseClaimResponsePaymentComponentContent(eventType, xpp, res))
6816        unknownContent(xpp);
6817      eventType = nextNoWhitespace(xpp);
6818    }
6819    next(xpp);
6820    parseElementClose(res);
6821    return res;
6822  }
6823
6824  protected boolean parseClaimResponsePaymentComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.PaymentComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6825    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
6826      res.setType(parseCodeableConcept(xpp));
6827    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjustment")) {
6828      res.setAdjustment(parseMoney(xpp));
6829    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("adjustmentReason")) {
6830      res.setAdjustmentReason(parseCodeableConcept(xpp));
6831    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
6832      res.setDateElement(parseDate(xpp));
6833    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("amount")) {
6834      res.setAmount(parseMoney(xpp));
6835    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
6836      res.setIdentifier(parseIdentifier(xpp));
6837    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6838      return false;
6839    }
6840    return true;
6841  }
6842
6843  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6844    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
6845    parseElementAttributes(xpp, res);
6846    next(xpp);
6847    int eventType = nextNoWhitespace(xpp);
6848    while (eventType != XmlPullParser.END_TAG) {
6849    if (!parseClaimResponseNoteComponentContent(eventType, xpp, res))
6850        unknownContent(xpp);
6851      eventType = nextNoWhitespace(xpp);
6852    }
6853    next(xpp);
6854    parseElementClose(res);
6855    return res;
6856  }
6857
6858  protected boolean parseClaimResponseNoteComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.NoteComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6859    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("number")) {
6860      res.setNumberElement(parsePositiveInt(xpp));
6861    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
6862      res.setTypeElement(parseEnumeration(xpp, Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
6863    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
6864      res.setTextElement(parseString(xpp));
6865    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
6866      res.setLanguage(parseCodeableConcept(xpp));
6867    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6868      return false;
6869    }
6870    return true;
6871  }
6872
6873  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6874    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
6875    parseElementAttributes(xpp, res);
6876    next(xpp);
6877    int eventType = nextNoWhitespace(xpp);
6878    while (eventType != XmlPullParser.END_TAG) {
6879    if (!parseClaimResponseInsuranceComponentContent(eventType, xpp, res))
6880        unknownContent(xpp);
6881      eventType = nextNoWhitespace(xpp);
6882    }
6883    next(xpp);
6884    parseElementClose(res);
6885    return res;
6886  }
6887
6888  protected boolean parseClaimResponseInsuranceComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.InsuranceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6889    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sequence")) {
6890      res.setSequenceElement(parsePositiveInt(xpp));
6891    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focal")) {
6892      res.setFocalElement(parseBoolean(xpp));
6893    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("coverage")) {
6894      res.setCoverage(parseReference(xpp));
6895    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("businessArrangement")) {
6896      res.setBusinessArrangementElement(parseString(xpp));
6897    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("claimResponse")) {
6898      res.setClaimResponse(parseReference(xpp));
6899    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6900      return false;
6901    }
6902    return true;
6903  }
6904
6905  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6906    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
6907    parseElementAttributes(xpp, res);
6908    next(xpp);
6909    int eventType = nextNoWhitespace(xpp);
6910    while (eventType != XmlPullParser.END_TAG) {
6911    if (!parseClaimResponseErrorComponentContent(eventType, xpp, res))
6912        unknownContent(xpp);
6913      eventType = nextNoWhitespace(xpp);
6914    }
6915    next(xpp);
6916    parseElementClose(res);
6917    return res;
6918  }
6919
6920  protected boolean parseClaimResponseErrorComponentContent(int eventType, XmlPullParser xpp, ClaimResponse.ErrorComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
6921    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("itemSequence")) {
6922      res.setItemSequenceElement(parsePositiveInt(xpp));
6923    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detailSequence")) {
6924      res.setDetailSequenceElement(parsePositiveInt(xpp));
6925    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subDetailSequence")) {
6926      res.setSubDetailSequenceElement(parsePositiveInt(xpp));
6927    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
6928      res.setCode(parseCodeableConcept(xpp));
6929    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
6930      return false;
6931    }
6932    return true;
6933  }
6934
6935  protected ClinicalImpression parseClinicalImpression(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6936    ClinicalImpression res = new ClinicalImpression();
6937    parseResourceAttributes(xpp, res);
6938    next(xpp);
6939    int eventType = nextNoWhitespace(xpp);
6940    while (eventType != XmlPullParser.END_TAG) {
6941    if (!parseClinicalImpressionContent(eventType, xpp, res))
6942        unknownContent(xpp);
6943      eventType = nextNoWhitespace(xpp);
6944    }
6945    next(xpp);
6946    parseElementClose(res);
6947    return res;
6948  }
6949
6950  protected boolean parseClinicalImpressionContent(int eventType, XmlPullParser xpp, ClinicalImpression res) throws XmlPullParserException, IOException, FHIRFormatError {
6951    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
6952      res.getIdentifier().add(parseIdentifier(xpp));
6953    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
6954      res.setStatusElement(parseEnumeration(xpp, Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
6955    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
6956      res.setStatusReason(parseCodeableConcept(xpp));
6957    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
6958      res.setDescriptionElement(parseString(xpp));
6959    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
6960      res.setSubject(parseReference(xpp));
6961    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
6962      res.setEncounter(parseReference(xpp));
6963    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "effective")) {
6964      res.setEffective(parseType("effective", xpp));
6965    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
6966      res.setDateElement(parseDateTime(xpp));
6967    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
6968      res.setPerformer(parseReference(xpp));
6969    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("previous")) {
6970      res.setPrevious(parseReference(xpp));
6971    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("problem")) {
6972      res.getProblem().add(parseReference(xpp));
6973    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("changePattern")) {
6974      res.setChangePattern(parseCodeableConcept(xpp));
6975    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocol")) {
6976      res.getProtocol().add(parseUri(xpp));
6977    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
6978      res.setSummaryElement(parseString(xpp));
6979    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("finding")) {
6980      res.getFinding().add(parseClinicalImpressionFindingComponent(xpp));
6981    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prognosisCodeableConcept")) {
6982      res.getPrognosisCodeableConcept().add(parseCodeableConcept(xpp));
6983    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prognosisReference")) {
6984      res.getPrognosisReference().add(parseReference(xpp));
6985    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supportingInfo")) {
6986      res.getSupportingInfo().add(parseReference(xpp));
6987    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
6988      res.getNote().add(parseAnnotation(xpp));
6989    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
6990      return false;
6991    }
6992    return true;
6993  }
6994
6995  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionFindingComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
6996    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
6997    parseElementAttributes(xpp, res);
6998    next(xpp);
6999    int eventType = nextNoWhitespace(xpp);
7000    while (eventType != XmlPullParser.END_TAG) {
7001    if (!parseClinicalImpressionFindingComponentContent(eventType, xpp, res))
7002        unknownContent(xpp);
7003      eventType = nextNoWhitespace(xpp);
7004    }
7005    next(xpp);
7006    parseElementClose(res);
7007    return res;
7008  }
7009
7010  protected boolean parseClinicalImpressionFindingComponentContent(int eventType, XmlPullParser xpp, ClinicalImpression.ClinicalImpressionFindingComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7011    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
7012      res.setItem(parseCodeableReference(xpp));
7013    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basis")) {
7014      res.setBasisElement(parseString(xpp));
7015    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7016      return false;
7017    }
7018    return true;
7019  }
7020
7021  protected ClinicalUseDefinition parseClinicalUseDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7022    ClinicalUseDefinition res = new ClinicalUseDefinition();
7023    parseResourceAttributes(xpp, res);
7024    next(xpp);
7025    int eventType = nextNoWhitespace(xpp);
7026    while (eventType != XmlPullParser.END_TAG) {
7027    if (!parseClinicalUseDefinitionContent(eventType, xpp, res))
7028        unknownContent(xpp);
7029      eventType = nextNoWhitespace(xpp);
7030    }
7031    next(xpp);
7032    parseElementClose(res);
7033    return res;
7034  }
7035
7036  protected boolean parseClinicalUseDefinitionContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
7037    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
7038      res.getIdentifier().add(parseIdentifier(xpp));
7039    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
7040      res.setTypeElement(parseEnumeration(xpp, ClinicalUseDefinition.ClinicalUseDefinitionType.NULL, new ClinicalUseDefinition.ClinicalUseDefinitionTypeEnumFactory()));
7041    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
7042      res.getCategory().add(parseCodeableConcept(xpp));
7043    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
7044      res.getSubject().add(parseReference(xpp));
7045    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
7046      res.setStatus(parseCodeableConcept(xpp));
7047    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contraindication")) {
7048      res.setContraindication(parseClinicalUseDefinitionContraindicationComponent(xpp));
7049    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indication")) {
7050      res.setIndication(parseClinicalUseDefinitionIndicationComponent(xpp));
7051    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interaction")) {
7052      res.setInteraction(parseClinicalUseDefinitionInteractionComponent(xpp));
7053    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("population")) {
7054      res.getPopulation().add(parseReference(xpp));
7055    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("undesirableEffect")) {
7056      res.setUndesirableEffect(parseClinicalUseDefinitionUndesirableEffectComponent(xpp));
7057    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("warning")) {
7058      res.setWarning(parseClinicalUseDefinitionWarningComponent(xpp));
7059    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
7060      return false;
7061    }
7062    return true;
7063  }
7064
7065  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent parseClinicalUseDefinitionContraindicationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7066    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent();
7067    parseElementAttributes(xpp, res);
7068    next(xpp);
7069    int eventType = nextNoWhitespace(xpp);
7070    while (eventType != XmlPullParser.END_TAG) {
7071    if (!parseClinicalUseDefinitionContraindicationComponentContent(eventType, xpp, res))
7072        unknownContent(xpp);
7073      eventType = nextNoWhitespace(xpp);
7074    }
7075    next(xpp);
7076    parseElementClose(res);
7077    return res;
7078  }
7079
7080  protected boolean parseClinicalUseDefinitionContraindicationComponentContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7081    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diseaseSymptomProcedure")) {
7082      res.setDiseaseSymptomProcedure(parseCodeableReference(xpp));
7083    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diseaseStatus")) {
7084      res.setDiseaseStatus(parseCodeableReference(xpp));
7085    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comorbidity")) {
7086      res.getComorbidity().add(parseCodeableReference(xpp));
7087    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indication")) {
7088      res.getIndication().add(parseReference(xpp));
7089    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherTherapy")) {
7090      res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(xpp));
7091    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7092      return false;
7093    }
7094    return true;
7095  }
7096
7097  protected ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent parseClinicalUseDefinitionContraindicationOtherTherapyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7098    ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent();
7099    parseElementAttributes(xpp, res);
7100    next(xpp);
7101    int eventType = nextNoWhitespace(xpp);
7102    while (eventType != XmlPullParser.END_TAG) {
7103    if (!parseClinicalUseDefinitionContraindicationOtherTherapyComponentContent(eventType, xpp, res))
7104        unknownContent(xpp);
7105      eventType = nextNoWhitespace(xpp);
7106    }
7107    next(xpp);
7108    parseElementClose(res);
7109    return res;
7110  }
7111
7112  protected boolean parseClinicalUseDefinitionContraindicationOtherTherapyComponentContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition.ClinicalUseDefinitionContraindicationOtherTherapyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7113    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationshipType")) {
7114      res.setRelationshipType(parseCodeableConcept(xpp));
7115    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("treatment")) {
7116      res.setTreatment(parseCodeableReference(xpp));
7117    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7118      return false;
7119    }
7120    return true;
7121  }
7122
7123  protected ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent parseClinicalUseDefinitionIndicationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7124    ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent();
7125    parseElementAttributes(xpp, res);
7126    next(xpp);
7127    int eventType = nextNoWhitespace(xpp);
7128    while (eventType != XmlPullParser.END_TAG) {
7129    if (!parseClinicalUseDefinitionIndicationComponentContent(eventType, xpp, res))
7130        unknownContent(xpp);
7131      eventType = nextNoWhitespace(xpp);
7132    }
7133    next(xpp);
7134    parseElementClose(res);
7135    return res;
7136  }
7137
7138  protected boolean parseClinicalUseDefinitionIndicationComponentContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition.ClinicalUseDefinitionIndicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7139    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diseaseSymptomProcedure")) {
7140      res.setDiseaseSymptomProcedure(parseCodeableReference(xpp));
7141    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("diseaseStatus")) {
7142      res.setDiseaseStatus(parseCodeableReference(xpp));
7143    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comorbidity")) {
7144      res.getComorbidity().add(parseCodeableReference(xpp));
7145    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intendedEffect")) {
7146      res.setIntendedEffect(parseCodeableReference(xpp));
7147    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "duration")) {
7148      res.setDuration(parseType("duration", xpp));
7149    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("undesirableEffect")) {
7150      res.getUndesirableEffect().add(parseReference(xpp));
7151    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherTherapy")) {
7152      res.getOtherTherapy().add(parseClinicalUseDefinitionContraindicationOtherTherapyComponent(xpp));
7153    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7154      return false;
7155    }
7156    return true;
7157  }
7158
7159  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent parseClinicalUseDefinitionInteractionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7160    ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent();
7161    parseElementAttributes(xpp, res);
7162    next(xpp);
7163    int eventType = nextNoWhitespace(xpp);
7164    while (eventType != XmlPullParser.END_TAG) {
7165    if (!parseClinicalUseDefinitionInteractionComponentContent(eventType, xpp, res))
7166        unknownContent(xpp);
7167      eventType = nextNoWhitespace(xpp);
7168    }
7169    next(xpp);
7170    parseElementClose(res);
7171    return res;
7172  }
7173
7174  protected boolean parseClinicalUseDefinitionInteractionComponentContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition.ClinicalUseDefinitionInteractionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7175    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("interactant")) {
7176      res.getInteractant().add(parseClinicalUseDefinitionInteractionInteractantComponent(xpp));
7177    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
7178      res.setType(parseCodeableConcept(xpp));
7179    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effect")) {
7180      res.setEffect(parseCodeableReference(xpp));
7181    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("incidence")) {
7182      res.setIncidence(parseCodeableConcept(xpp));
7183    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("management")) {
7184      res.getManagement().add(parseCodeableConcept(xpp));
7185    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7186      return false;
7187    }
7188    return true;
7189  }
7190
7191  protected ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent parseClinicalUseDefinitionInteractionInteractantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7192    ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent();
7193    parseElementAttributes(xpp, res);
7194    next(xpp);
7195    int eventType = nextNoWhitespace(xpp);
7196    while (eventType != XmlPullParser.END_TAG) {
7197    if (!parseClinicalUseDefinitionInteractionInteractantComponentContent(eventType, xpp, res))
7198        unknownContent(xpp);
7199      eventType = nextNoWhitespace(xpp);
7200    }
7201    next(xpp);
7202    parseElementClose(res);
7203    return res;
7204  }
7205
7206  protected boolean parseClinicalUseDefinitionInteractionInteractantComponentContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition.ClinicalUseDefinitionInteractionInteractantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7207    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "item")) {
7208      res.setItem(parseType("item", xpp));
7209    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7210      return false;
7211    }
7212    return true;
7213  }
7214
7215  protected ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent parseClinicalUseDefinitionUndesirableEffectComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7216    ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent();
7217    parseElementAttributes(xpp, res);
7218    next(xpp);
7219    int eventType = nextNoWhitespace(xpp);
7220    while (eventType != XmlPullParser.END_TAG) {
7221    if (!parseClinicalUseDefinitionUndesirableEffectComponentContent(eventType, xpp, res))
7222        unknownContent(xpp);
7223      eventType = nextNoWhitespace(xpp);
7224    }
7225    next(xpp);
7226    parseElementClose(res);
7227    return res;
7228  }
7229
7230  protected boolean parseClinicalUseDefinitionUndesirableEffectComponentContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition.ClinicalUseDefinitionUndesirableEffectComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7231    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("symptomConditionEffect")) {
7232      res.setSymptomConditionEffect(parseCodeableReference(xpp));
7233    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("classification")) {
7234      res.setClassification(parseCodeableConcept(xpp));
7235    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("frequencyOfOccurrence")) {
7236      res.setFrequencyOfOccurrence(parseCodeableConcept(xpp));
7237    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7238      return false;
7239    }
7240    return true;
7241  }
7242
7243  protected ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent parseClinicalUseDefinitionWarningComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7244    ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res = new ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent();
7245    parseElementAttributes(xpp, res);
7246    next(xpp);
7247    int eventType = nextNoWhitespace(xpp);
7248    while (eventType != XmlPullParser.END_TAG) {
7249    if (!parseClinicalUseDefinitionWarningComponentContent(eventType, xpp, res))
7250        unknownContent(xpp);
7251      eventType = nextNoWhitespace(xpp);
7252    }
7253    next(xpp);
7254    parseElementClose(res);
7255    return res;
7256  }
7257
7258  protected boolean parseClinicalUseDefinitionWarningComponentContent(int eventType, XmlPullParser xpp, ClinicalUseDefinition.ClinicalUseDefinitionWarningComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7259    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
7260      res.setDescriptionElement(parseMarkdown(xpp));
7261    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7262      res.setCode(parseCodeableConcept(xpp));
7263    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7264      return false;
7265    }
7266    return true;
7267  }
7268
7269  protected CodeSystem parseCodeSystem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7270    CodeSystem res = new CodeSystem();
7271    parseResourceAttributes(xpp, res);
7272    next(xpp);
7273    int eventType = nextNoWhitespace(xpp);
7274    while (eventType != XmlPullParser.END_TAG) {
7275    if (!parseCodeSystemContent(eventType, xpp, res))
7276        unknownContent(xpp);
7277      eventType = nextNoWhitespace(xpp);
7278    }
7279    next(xpp);
7280    parseElementClose(res);
7281    return res;
7282  }
7283
7284  protected boolean parseCodeSystemContent(int eventType, XmlPullParser xpp, CodeSystem res) throws XmlPullParserException, IOException, FHIRFormatError {
7285    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
7286      res.setUrlElement(parseUri(xpp));
7287    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
7288      res.getIdentifier().add(parseIdentifier(xpp));
7289    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
7290      res.setVersionElement(parseString(xpp));
7291    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
7292      res.setNameElement(parseString(xpp));
7293    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
7294      res.setTitleElement(parseString(xpp));
7295    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
7296      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7297    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
7298      res.setExperimentalElement(parseBoolean(xpp));
7299    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
7300      res.setDateElement(parseDateTime(xpp));
7301    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
7302      res.setPublisherElement(parseString(xpp));
7303    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
7304      res.getContact().add(parseContactDetail(xpp));
7305    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
7306      res.setDescriptionElement(parseMarkdown(xpp));
7307    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
7308      res.getUseContext().add(parseUsageContext(xpp));
7309    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
7310      res.getJurisdiction().add(parseCodeableConcept(xpp));
7311    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
7312      res.setPurposeElement(parseMarkdown(xpp));
7313    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
7314      res.setCopyrightElement(parseMarkdown(xpp));
7315    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
7316      res.setApprovalDateElement(parseDate(xpp));
7317    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
7318      res.setLastReviewDateElement(parseDate(xpp));
7319    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
7320      res.setEffectivePeriod(parsePeriod(xpp));
7321    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
7322      res.getTopic().add(parseCodeableConcept(xpp));
7323    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
7324      res.getAuthor().add(parseContactDetail(xpp));
7325    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
7326      res.getEditor().add(parseContactDetail(xpp));
7327    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
7328      res.getReviewer().add(parseContactDetail(xpp));
7329    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
7330      res.getEndorser().add(parseContactDetail(xpp));
7331    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
7332      res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
7333    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("caseSensitive")) {
7334      res.setCaseSensitiveElement(parseBoolean(xpp));
7335    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
7336      res.setValueSetElement(parseCanonical(xpp));
7337    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hierarchyMeaning")) {
7338      res.setHierarchyMeaningElement(parseEnumeration(xpp, CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
7339    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compositional")) {
7340      res.setCompositionalElement(parseBoolean(xpp));
7341    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versionNeeded")) {
7342      res.setVersionNeededElement(parseBoolean(xpp));
7343    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
7344      res.setContentElement(parseEnumeration(xpp, CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
7345    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("supplements")) {
7346      res.setSupplementsElement(parseCanonical(xpp));
7347    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("count")) {
7348      res.setCountElement(parseUnsignedInt(xpp));
7349    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("filter")) {
7350      res.getFilter().add(parseCodeSystemFilterComponent(xpp));
7351    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
7352      res.getProperty().add(parseCodeSystemPropertyComponent(xpp));
7353    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
7354      res.getConcept().add(parseCodeSystemConceptDefinitionComponent(xpp));
7355    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
7356      return false;
7357    }
7358    return true;
7359  }
7360
7361  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemFilterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7362    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
7363    parseElementAttributes(xpp, res);
7364    next(xpp);
7365    int eventType = nextNoWhitespace(xpp);
7366    while (eventType != XmlPullParser.END_TAG) {
7367    if (!parseCodeSystemFilterComponentContent(eventType, xpp, res))
7368        unknownContent(xpp);
7369      eventType = nextNoWhitespace(xpp);
7370    }
7371    next(xpp);
7372    parseElementClose(res);
7373    return res;
7374  }
7375
7376  protected boolean parseCodeSystemFilterComponentContent(int eventType, XmlPullParser xpp, CodeSystem.CodeSystemFilterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7377    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7378      res.setCodeElement(parseCode(xpp));
7379    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
7380      res.setDescriptionElement(parseString(xpp));
7381    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operator")) {
7382      res.getOperator().add(parseEnumeration(xpp, Enumerations.FilterOperator.NULL, new Enumerations.FilterOperatorEnumFactory()));
7383    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
7384      res.setValueElement(parseString(xpp));
7385    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7386      return false;
7387    }
7388    return true;
7389  }
7390
7391  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7392    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
7393    parseElementAttributes(xpp, res);
7394    next(xpp);
7395    int eventType = nextNoWhitespace(xpp);
7396    while (eventType != XmlPullParser.END_TAG) {
7397    if (!parseCodeSystemPropertyComponentContent(eventType, xpp, res))
7398        unknownContent(xpp);
7399      eventType = nextNoWhitespace(xpp);
7400    }
7401    next(xpp);
7402    parseElementClose(res);
7403    return res;
7404  }
7405
7406  protected boolean parseCodeSystemPropertyComponentContent(int eventType, XmlPullParser xpp, CodeSystem.PropertyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7407    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7408      res.setCodeElement(parseCode(xpp));
7409    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
7410      res.setUriElement(parseUri(xpp));
7411    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
7412      res.setDescriptionElement(parseString(xpp));
7413    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
7414      res.setTypeElement(parseEnumeration(xpp, CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
7415    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7416      return false;
7417    }
7418    return true;
7419  }
7420
7421  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7422    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
7423    parseElementAttributes(xpp, res);
7424    next(xpp);
7425    int eventType = nextNoWhitespace(xpp);
7426    while (eventType != XmlPullParser.END_TAG) {
7427    if (!parseCodeSystemConceptDefinitionComponentContent(eventType, xpp, res))
7428        unknownContent(xpp);
7429      eventType = nextNoWhitespace(xpp);
7430    }
7431    next(xpp);
7432    parseElementClose(res);
7433    return res;
7434  }
7435
7436  protected boolean parseCodeSystemConceptDefinitionComponentContent(int eventType, XmlPullParser xpp, CodeSystem.ConceptDefinitionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7437    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7438      res.setCodeElement(parseCode(xpp));
7439    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
7440      res.setDisplayElement(parseString(xpp));
7441    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
7442      res.setDefinitionElement(parseString(xpp));
7443    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("designation")) {
7444      res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(xpp));
7445    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
7446      res.getProperty().add(parseCodeSystemConceptPropertyComponent(xpp));
7447    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("concept")) {
7448      res.getConcept().add(parseCodeSystemConceptDefinitionComponent(xpp));
7449    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7450      return false;
7451    }
7452    return true;
7453  }
7454
7455  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7456    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
7457    parseElementAttributes(xpp, res);
7458    next(xpp);
7459    int eventType = nextNoWhitespace(xpp);
7460    while (eventType != XmlPullParser.END_TAG) {
7461    if (!parseCodeSystemConceptDefinitionDesignationComponentContent(eventType, xpp, res))
7462        unknownContent(xpp);
7463      eventType = nextNoWhitespace(xpp);
7464    }
7465    next(xpp);
7466    parseElementClose(res);
7467    return res;
7468  }
7469
7470  protected boolean parseCodeSystemConceptDefinitionDesignationComponentContent(int eventType, XmlPullParser xpp, CodeSystem.ConceptDefinitionDesignationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7471    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
7472      res.setLanguageElement(parseCode(xpp));
7473    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
7474      res.setUse(parseCoding(xpp));
7475    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("additionalUse")) {
7476      res.getAdditionalUse().add(parseCoding(xpp));
7477    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
7478      res.setValueElement(parseString(xpp));
7479    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7480      return false;
7481    }
7482    return true;
7483  }
7484
7485  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7486    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
7487    parseElementAttributes(xpp, res);
7488    next(xpp);
7489    int eventType = nextNoWhitespace(xpp);
7490    while (eventType != XmlPullParser.END_TAG) {
7491    if (!parseCodeSystemConceptPropertyComponentContent(eventType, xpp, res))
7492        unknownContent(xpp);
7493      eventType = nextNoWhitespace(xpp);
7494    }
7495    next(xpp);
7496    parseElementClose(res);
7497    return res;
7498  }
7499
7500  protected boolean parseCodeSystemConceptPropertyComponentContent(int eventType, XmlPullParser xpp, CodeSystem.ConceptPropertyComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7501    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7502      res.setCodeElement(parseCode(xpp));
7503    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
7504      res.setValue(parseType("value", xpp));
7505    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7506      return false;
7507    }
7508    return true;
7509  }
7510
7511  protected Communication parseCommunication(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7512    Communication res = new Communication();
7513    parseResourceAttributes(xpp, res);
7514    next(xpp);
7515    int eventType = nextNoWhitespace(xpp);
7516    while (eventType != XmlPullParser.END_TAG) {
7517    if (!parseCommunicationContent(eventType, xpp, res))
7518        unknownContent(xpp);
7519      eventType = nextNoWhitespace(xpp);
7520    }
7521    next(xpp);
7522    parseElementClose(res);
7523    return res;
7524  }
7525
7526  protected boolean parseCommunicationContent(int eventType, XmlPullParser xpp, Communication res) throws XmlPullParserException, IOException, FHIRFormatError {
7527    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
7528      res.getIdentifier().add(parseIdentifier(xpp));
7529    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesCanonical")) {
7530      res.getInstantiatesCanonical().add(parseCanonical(xpp));
7531    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instantiatesUri")) {
7532      res.getInstantiatesUri().add(parseUri(xpp));
7533    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
7534      res.getBasedOn().add(parseReference(xpp));
7535    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("partOf")) {
7536      res.getPartOf().add(parseReference(xpp));
7537    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inResponseTo")) {
7538      res.getInResponseTo().add(parseReference(xpp));
7539    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
7540      res.setStatusElement(parseEnumeration(xpp, Enumerations.EventStatus.NULL, new Enumerations.EventStatusEnumFactory()));
7541    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
7542      res.setStatusReason(parseCodeableConcept(xpp));
7543    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
7544      res.getCategory().add(parseCodeableConcept(xpp));
7545    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
7546      res.setPriorityElement(parseEnumeration(xpp, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
7547    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medium")) {
7548      res.getMedium().add(parseCodeableConcept(xpp));
7549    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
7550      res.setSubject(parseReference(xpp));
7551    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
7552      res.setTopic(parseCodeableConcept(xpp));
7553    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("about")) {
7554      res.getAbout().add(parseReference(xpp));
7555    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
7556      res.setEncounter(parseReference(xpp));
7557    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sent")) {
7558      res.setSentElement(parseDateTime(xpp));
7559    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("received")) {
7560      res.setReceivedElement(parseDateTime(xpp));
7561    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
7562      res.getRecipient().add(parseReference(xpp));
7563    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sender")) {
7564      res.setSender(parseReference(xpp));
7565    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
7566      res.getReason().add(parseCodeableReference(xpp));
7567    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payload")) {
7568      res.getPayload().add(parseCommunicationPayloadComponent(xpp));
7569    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
7570      res.getNote().add(parseAnnotation(xpp));
7571    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
7572      return false;
7573    }
7574    return true;
7575  }
7576
7577  protected Communication.CommunicationPayloadComponent parseCommunicationPayloadComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7578    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
7579    parseElementAttributes(xpp, res);
7580    next(xpp);
7581    int eventType = nextNoWhitespace(xpp);
7582    while (eventType != XmlPullParser.END_TAG) {
7583    if (!parseCommunicationPayloadComponentContent(eventType, xpp, res))
7584        unknownContent(xpp);
7585      eventType = nextNoWhitespace(xpp);
7586    }
7587    next(xpp);
7588    parseElementClose(res);
7589    return res;
7590  }
7591
7592  protected boolean parseCommunicationPayloadComponentContent(int eventType, XmlPullParser xpp, Communication.CommunicationPayloadComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7593    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "content")) {
7594      res.setContent(parseType("content", xpp));
7595    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7596      return false;
7597    }
7598    return true;
7599  }
7600
7601  protected CommunicationRequest parseCommunicationRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7602    CommunicationRequest res = new CommunicationRequest();
7603    parseResourceAttributes(xpp, res);
7604    next(xpp);
7605    int eventType = nextNoWhitespace(xpp);
7606    while (eventType != XmlPullParser.END_TAG) {
7607    if (!parseCommunicationRequestContent(eventType, xpp, res))
7608        unknownContent(xpp);
7609      eventType = nextNoWhitespace(xpp);
7610    }
7611    next(xpp);
7612    parseElementClose(res);
7613    return res;
7614  }
7615
7616  protected boolean parseCommunicationRequestContent(int eventType, XmlPullParser xpp, CommunicationRequest res) throws XmlPullParserException, IOException, FHIRFormatError {
7617    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
7618      res.getIdentifier().add(parseIdentifier(xpp));
7619    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("basedOn")) {
7620      res.getBasedOn().add(parseReference(xpp));
7621    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("replaces")) {
7622      res.getReplaces().add(parseReference(xpp));
7623    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("groupIdentifier")) {
7624      res.setGroupIdentifier(parseIdentifier(xpp));
7625    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
7626      res.setStatusElement(parseEnumeration(xpp, Enumerations.RequestStatus.NULL, new Enumerations.RequestStatusEnumFactory()));
7627    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("statusReason")) {
7628      res.setStatusReason(parseCodeableConcept(xpp));
7629    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("intent")) {
7630      res.setIntentElement(parseEnumeration(xpp, Enumerations.RequestIntent.NULL, new Enumerations.RequestIntentEnumFactory()));
7631    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
7632      res.getCategory().add(parseCodeableConcept(xpp));
7633    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("priority")) {
7634      res.setPriorityElement(parseEnumeration(xpp, Enumerations.RequestPriority.NULL, new Enumerations.RequestPriorityEnumFactory()));
7635    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("doNotPerform")) {
7636      res.setDoNotPerformElement(parseBoolean(xpp));
7637    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medium")) {
7638      res.getMedium().add(parseCodeableConcept(xpp));
7639    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
7640      res.setSubject(parseReference(xpp));
7641    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("about")) {
7642      res.getAbout().add(parseReference(xpp));
7643    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
7644      res.setEncounter(parseReference(xpp));
7645    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("payload")) {
7646      res.getPayload().add(parseCommunicationRequestPayloadComponent(xpp));
7647    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "occurrence")) {
7648      res.setOccurrence(parseType("occurrence", xpp));
7649    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("authoredOn")) {
7650      res.setAuthoredOnElement(parseDateTime(xpp));
7651    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("requester")) {
7652      res.setRequester(parseReference(xpp));
7653    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recipient")) {
7654      res.getRecipient().add(parseReference(xpp));
7655    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("informationProvider")) {
7656      res.getInformationProvider().add(parseReference(xpp));
7657    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
7658      res.getReason().add(parseCodeableReference(xpp));
7659    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
7660      res.getNote().add(parseAnnotation(xpp));
7661    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
7662      return false;
7663    }
7664    return true;
7665  }
7666
7667  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestPayloadComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7668    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
7669    parseElementAttributes(xpp, res);
7670    next(xpp);
7671    int eventType = nextNoWhitespace(xpp);
7672    while (eventType != XmlPullParser.END_TAG) {
7673    if (!parseCommunicationRequestPayloadComponentContent(eventType, xpp, res))
7674        unknownContent(xpp);
7675      eventType = nextNoWhitespace(xpp);
7676    }
7677    next(xpp);
7678    parseElementClose(res);
7679    return res;
7680  }
7681
7682  protected boolean parseCommunicationRequestPayloadComponentContent(int eventType, XmlPullParser xpp, CommunicationRequest.CommunicationRequestPayloadComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7683    if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "content")) {
7684      res.setContent(parseType("content", xpp));
7685    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7686      return false;
7687    }
7688    return true;
7689  }
7690
7691  protected CompartmentDefinition parseCompartmentDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7692    CompartmentDefinition res = new CompartmentDefinition();
7693    parseResourceAttributes(xpp, res);
7694    next(xpp);
7695    int eventType = nextNoWhitespace(xpp);
7696    while (eventType != XmlPullParser.END_TAG) {
7697    if (!parseCompartmentDefinitionContent(eventType, xpp, res))
7698        unknownContent(xpp);
7699      eventType = nextNoWhitespace(xpp);
7700    }
7701    next(xpp);
7702    parseElementClose(res);
7703    return res;
7704  }
7705
7706  protected boolean parseCompartmentDefinitionContent(int eventType, XmlPullParser xpp, CompartmentDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
7707    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
7708      res.setUrlElement(parseUri(xpp));
7709    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
7710      res.setVersionElement(parseString(xpp));
7711    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "versionAlgorithm")) {
7712      res.setVersionAlgorithm(parseType("versionAlgorithm", xpp));
7713    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
7714      res.setNameElement(parseString(xpp));
7715    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
7716      res.setTitleElement(parseString(xpp));
7717    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
7718      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7719    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
7720      res.setExperimentalElement(parseBoolean(xpp));
7721    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
7722      res.setDateElement(parseDateTime(xpp));
7723    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
7724      res.setPublisherElement(parseString(xpp));
7725    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
7726      res.getContact().add(parseContactDetail(xpp));
7727    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
7728      res.setDescriptionElement(parseMarkdown(xpp));
7729    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
7730      res.getUseContext().add(parseUsageContext(xpp));
7731    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
7732      res.setPurposeElement(parseMarkdown(xpp));
7733    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7734      res.setCodeElement(parseEnumeration(xpp, Enumerations.CompartmentType.NULL, new Enumerations.CompartmentTypeEnumFactory()));
7735    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("search")) {
7736      res.setSearchElement(parseBoolean(xpp));
7737    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) {
7738      res.getResource().add(parseCompartmentDefinitionResourceComponent(xpp));
7739    } else if (!parseCanonicalResourceContent(eventType, xpp, res)){ 
7740      return false;
7741    }
7742    return true;
7743  }
7744
7745  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionResourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7746    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
7747    parseElementAttributes(xpp, res);
7748    next(xpp);
7749    int eventType = nextNoWhitespace(xpp);
7750    while (eventType != XmlPullParser.END_TAG) {
7751    if (!parseCompartmentDefinitionResourceComponentContent(eventType, xpp, res))
7752        unknownContent(xpp);
7753      eventType = nextNoWhitespace(xpp);
7754    }
7755    next(xpp);
7756    parseElementClose(res);
7757    return res;
7758  }
7759
7760  protected boolean parseCompartmentDefinitionResourceComponentContent(int eventType, XmlPullParser xpp, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7761    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7762      res.setCodeElement(parseCode(xpp));
7763    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("param")) {
7764      res.getParam().add(parseString(xpp));
7765    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("documentation")) {
7766      res.setDocumentationElement(parseString(xpp));
7767    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("startParam")) {
7768      res.setStartParamElement(parseUri(xpp));
7769    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endParam")) {
7770      res.setEndParamElement(parseUri(xpp));
7771    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7772      return false;
7773    }
7774    return true;
7775  }
7776
7777  protected Composition parseComposition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7778    Composition res = new Composition();
7779    parseResourceAttributes(xpp, res);
7780    next(xpp);
7781    int eventType = nextNoWhitespace(xpp);
7782    while (eventType != XmlPullParser.END_TAG) {
7783    if (!parseCompositionContent(eventType, xpp, res))
7784        unknownContent(xpp);
7785      eventType = nextNoWhitespace(xpp);
7786    }
7787    next(xpp);
7788    parseElementClose(res);
7789    return res;
7790  }
7791
7792  protected boolean parseCompositionContent(int eventType, XmlPullParser xpp, Composition res) throws XmlPullParserException, IOException, FHIRFormatError {
7793    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
7794      res.setUrlElement(parseUri(xpp));
7795    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
7796      res.getIdentifier().add(parseIdentifier(xpp));
7797    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
7798      res.setVersionElement(parseString(xpp));
7799    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
7800      res.setStatusElement(parseEnumeration(xpp, Enumerations.CompositionStatus.NULL, new Enumerations.CompositionStatusEnumFactory()));
7801    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
7802      res.setType(parseCodeableConcept(xpp));
7803    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
7804      res.getCategory().add(parseCodeableConcept(xpp));
7805    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
7806      res.getSubject().add(parseReference(xpp));
7807    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
7808      res.setEncounter(parseReference(xpp));
7809    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
7810      res.setDateElement(parseDateTime(xpp));
7811    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
7812      res.getUseContext().add(parseUsageContext(xpp));
7813    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
7814      res.getAuthor().add(parseReference(xpp));
7815    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
7816      res.setNameElement(parseString(xpp));
7817    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
7818      res.setTitleElement(parseString(xpp));
7819    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
7820      res.getNote().add(parseAnnotation(xpp));
7821    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attester")) {
7822      res.getAttester().add(parseCompositionAttesterComponent(xpp));
7823    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian")) {
7824      res.setCustodian(parseReference(xpp));
7825    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatesTo")) {
7826      res.getRelatesTo().add(parseRelatedArtifact(xpp));
7827    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("event")) {
7828      res.getEvent().add(parseCompositionEventComponent(xpp));
7829    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("section")) {
7830      res.getSection().add(parseCompositionSectionComponent(xpp));
7831    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
7832      return false;
7833    }
7834    return true;
7835  }
7836
7837  protected Composition.CompositionAttesterComponent parseCompositionAttesterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7838    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
7839    parseElementAttributes(xpp, res);
7840    next(xpp);
7841    int eventType = nextNoWhitespace(xpp);
7842    while (eventType != XmlPullParser.END_TAG) {
7843    if (!parseCompositionAttesterComponentContent(eventType, xpp, res))
7844        unknownContent(xpp);
7845      eventType = nextNoWhitespace(xpp);
7846    }
7847    next(xpp);
7848    parseElementClose(res);
7849    return res;
7850  }
7851
7852  protected boolean parseCompositionAttesterComponentContent(int eventType, XmlPullParser xpp, Composition.CompositionAttesterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7853    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
7854      res.setMode(parseCodeableConcept(xpp));
7855    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
7856      res.setTimeElement(parseDateTime(xpp));
7857    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("party")) {
7858      res.setParty(parseReference(xpp));
7859    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7860      return false;
7861    }
7862    return true;
7863  }
7864
7865  protected Composition.CompositionEventComponent parseCompositionEventComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7866    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
7867    parseElementAttributes(xpp, res);
7868    next(xpp);
7869    int eventType = nextNoWhitespace(xpp);
7870    while (eventType != XmlPullParser.END_TAG) {
7871    if (!parseCompositionEventComponentContent(eventType, xpp, res))
7872        unknownContent(xpp);
7873      eventType = nextNoWhitespace(xpp);
7874    }
7875    next(xpp);
7876    parseElementClose(res);
7877    return res;
7878  }
7879
7880  protected boolean parseCompositionEventComponentContent(int eventType, XmlPullParser xpp, Composition.CompositionEventComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7881    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7882      res.getCode().add(parseCodeableConcept(xpp));
7883    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
7884      res.setPeriod(parsePeriod(xpp));
7885    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) {
7886      res.getDetail().add(parseReference(xpp));
7887    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7888      return false;
7889    }
7890    return true;
7891  }
7892
7893  protected Composition.SectionComponent parseCompositionSectionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7894    Composition.SectionComponent res = new Composition.SectionComponent();
7895    parseElementAttributes(xpp, res);
7896    next(xpp);
7897    int eventType = nextNoWhitespace(xpp);
7898    while (eventType != XmlPullParser.END_TAG) {
7899    if (!parseCompositionSectionComponentContent(eventType, xpp, res))
7900        unknownContent(xpp);
7901      eventType = nextNoWhitespace(xpp);
7902    }
7903    next(xpp);
7904    parseElementClose(res);
7905    return res;
7906  }
7907
7908  protected boolean parseCompositionSectionComponentContent(int eventType, XmlPullParser xpp, Composition.SectionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
7909    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
7910      res.setTitleElement(parseString(xpp));
7911    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
7912      res.setCode(parseCodeableConcept(xpp));
7913    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
7914      res.getAuthor().add(parseReference(xpp));
7915    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("focus")) {
7916      res.setFocus(parseReference(xpp));
7917    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("text")) {
7918      res.setText(parseNarrative(xpp));
7919    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
7920      res.setModeElement(parseEnumeration(xpp, Enumerations.ListMode.NULL, new Enumerations.ListModeEnumFactory()));
7921    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("orderedBy")) {
7922      res.setOrderedBy(parseCodeableConcept(xpp));
7923    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("entry")) {
7924      res.getEntry().add(parseReference(xpp));
7925    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("emptyReason")) {
7926      res.setEmptyReason(parseCodeableConcept(xpp));
7927    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("section")) {
7928      res.getSection().add(parseCompositionSectionComponent(xpp));
7929    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
7930      return false;
7931    }
7932    return true;
7933  }
7934
7935  protected ConceptMap parseConceptMap(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
7936    ConceptMap res = new ConceptMap();
7937    parseResourceAttributes(xpp, res);
7938    next(xpp);
7939    int eventType = nextNoWhitespace(xpp);
7940    while (eventType != XmlPullParser.END_TAG) {
7941    if (!parseConceptMapContent(eventType, xpp, res))
7942        unknownContent(xpp);
7943      eventType = nextNoWhitespace(xpp);
7944    }
7945    next(xpp);
7946    parseElementClose(res);
7947    return res;
7948  }
7949
7950  protected boolean parseConceptMapContent(int eventType, XmlPullParser xpp, ConceptMap res) throws XmlPullParserException, IOException, FHIRFormatError {
7951    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
7952      res.setUrlElement(parseUri(xpp));
7953    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
7954      res.getIdentifier().add(parseIdentifier(xpp));
7955    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
7956      res.setVersionElement(parseString(xpp));
7957    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
7958      res.setNameElement(parseString(xpp));
7959    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
7960      res.setTitleElement(parseString(xpp));
7961    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
7962      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
7963    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
7964      res.setExperimentalElement(parseBoolean(xpp));
7965    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
7966      res.setDateElement(parseDateTime(xpp));
7967    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
7968      res.setPublisherElement(parseString(xpp));
7969    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
7970      res.getContact().add(parseContactDetail(xpp));
7971    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
7972      res.setDescriptionElement(parseMarkdown(xpp));
7973    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
7974      res.getUseContext().add(parseUsageContext(xpp));
7975    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
7976      res.getJurisdiction().add(parseCodeableConcept(xpp));
7977    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
7978      res.setPurposeElement(parseMarkdown(xpp));
7979    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
7980      res.setCopyrightElement(parseMarkdown(xpp));
7981    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("approvalDate")) {
7982      res.setApprovalDateElement(parseDate(xpp));
7983    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lastReviewDate")) {
7984      res.setLastReviewDateElement(parseDate(xpp));
7985    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("effectivePeriod")) {
7986      res.setEffectivePeriod(parsePeriod(xpp));
7987    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) {
7988      res.getTopic().add(parseCodeableConcept(xpp));
7989    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
7990      res.getAuthor().add(parseContactDetail(xpp));
7991    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("editor")) {
7992      res.getEditor().add(parseContactDetail(xpp));
7993    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reviewer")) {
7994      res.getReviewer().add(parseContactDetail(xpp));
7995    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("endorser")) {
7996      res.getEndorser().add(parseContactDetail(xpp));
7997    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relatedArtifact")) {
7998      res.getRelatedArtifact().add(parseRelatedArtifact(xpp));
7999    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "sourceScope")) {
8000      res.setSourceScope(parseType("sourceScope", xpp));
8001    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "targetScope")) {
8002      res.setTargetScope(parseType("targetScope", xpp));
8003    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("group")) {
8004      res.getGroup().add(parseConceptMapGroupComponent(xpp));
8005    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
8006      return false;
8007    }
8008    return true;
8009  }
8010
8011  protected ConceptMap.ConceptMapGroupComponent parseConceptMapGroupComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8012    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
8013    parseElementAttributes(xpp, res);
8014    next(xpp);
8015    int eventType = nextNoWhitespace(xpp);
8016    while (eventType != XmlPullParser.END_TAG) {
8017    if (!parseConceptMapGroupComponentContent(eventType, xpp, res))
8018        unknownContent(xpp);
8019      eventType = nextNoWhitespace(xpp);
8020    }
8021    next(xpp);
8022    parseElementClose(res);
8023    return res;
8024  }
8025
8026  protected boolean parseConceptMapGroupComponentContent(int eventType, XmlPullParser xpp, ConceptMap.ConceptMapGroupComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8027    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
8028      res.setSourceElement(parseCanonical(xpp));
8029    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
8030      res.setTargetElement(parseCanonical(xpp));
8031    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("element")) {
8032      res.getElement().add(parseConceptMapSourceElementComponent(xpp));
8033    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("unmapped")) {
8034      res.setUnmapped(parseConceptMapGroupUnmappedComponent(xpp));
8035    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8036      return false;
8037    }
8038    return true;
8039  }
8040
8041  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8042    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
8043    parseElementAttributes(xpp, res);
8044    next(xpp);
8045    int eventType = nextNoWhitespace(xpp);
8046    while (eventType != XmlPullParser.END_TAG) {
8047    if (!parseConceptMapSourceElementComponentContent(eventType, xpp, res))
8048        unknownContent(xpp);
8049      eventType = nextNoWhitespace(xpp);
8050    }
8051    next(xpp);
8052    parseElementClose(res);
8053    return res;
8054  }
8055
8056  protected boolean parseConceptMapSourceElementComponentContent(int eventType, XmlPullParser xpp, ConceptMap.SourceElementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8057    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8058      res.setCodeElement(parseCode(xpp));
8059    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
8060      res.setDisplayElement(parseString(xpp));
8061    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
8062      res.setValueSetElement(parseCanonical(xpp));
8063    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("noMap")) {
8064      res.setNoMapElement(parseBoolean(xpp));
8065    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
8066      res.getTarget().add(parseConceptMapTargetElementComponent(xpp));
8067    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8068      return false;
8069    }
8070    return true;
8071  }
8072
8073  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8074    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
8075    parseElementAttributes(xpp, res);
8076    next(xpp);
8077    int eventType = nextNoWhitespace(xpp);
8078    while (eventType != XmlPullParser.END_TAG) {
8079    if (!parseConceptMapTargetElementComponentContent(eventType, xpp, res))
8080        unknownContent(xpp);
8081      eventType = nextNoWhitespace(xpp);
8082    }
8083    next(xpp);
8084    parseElementClose(res);
8085    return res;
8086  }
8087
8088  protected boolean parseConceptMapTargetElementComponentContent(int eventType, XmlPullParser xpp, ConceptMap.TargetElementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8089    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8090      res.setCodeElement(parseCode(xpp));
8091    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
8092      res.setDisplayElement(parseString(xpp));
8093    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
8094      res.setValueSetElement(parseCanonical(xpp));
8095    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
8096      res.setRelationshipElement(parseEnumeration(xpp, Enumerations.ConceptMapRelationship.NULL, new Enumerations.ConceptMapRelationshipEnumFactory()));
8097    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
8098      res.setCommentElement(parseString(xpp));
8099    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependsOn")) {
8100      res.getDependsOn().add(parseConceptMapOtherElementComponent(xpp));
8101    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("product")) {
8102      res.getProduct().add(parseConceptMapOtherElementComponent(xpp));
8103    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8104      return false;
8105    }
8106    return true;
8107  }
8108
8109  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8110    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
8111    parseElementAttributes(xpp, res);
8112    next(xpp);
8113    int eventType = nextNoWhitespace(xpp);
8114    while (eventType != XmlPullParser.END_TAG) {
8115    if (!parseConceptMapOtherElementComponentContent(eventType, xpp, res))
8116        unknownContent(xpp);
8117      eventType = nextNoWhitespace(xpp);
8118    }
8119    next(xpp);
8120    parseElementClose(res);
8121    return res;
8122  }
8123
8124  protected boolean parseConceptMapOtherElementComponentContent(int eventType, XmlPullParser xpp, ConceptMap.OtherElementComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8125    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("property")) {
8126      res.setPropertyElement(parseUri(xpp));
8127    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
8128      res.setValue(parseType("value", xpp));
8129    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
8130      res.setValueSetElement(parseCanonical(xpp));
8131    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8132      return false;
8133    }
8134    return true;
8135  }
8136
8137  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapGroupUnmappedComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8138    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
8139    parseElementAttributes(xpp, res);
8140    next(xpp);
8141    int eventType = nextNoWhitespace(xpp);
8142    while (eventType != XmlPullParser.END_TAG) {
8143    if (!parseConceptMapGroupUnmappedComponentContent(eventType, xpp, res))
8144        unknownContent(xpp);
8145      eventType = nextNoWhitespace(xpp);
8146    }
8147    next(xpp);
8148    parseElementClose(res);
8149    return res;
8150  }
8151
8152  protected boolean parseConceptMapGroupUnmappedComponentContent(int eventType, XmlPullParser xpp, ConceptMap.ConceptMapGroupUnmappedComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8153    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
8154      res.setModeElement(parseEnumeration(xpp, ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
8155    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8156      res.setCodeElement(parseCode(xpp));
8157    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("display")) {
8158      res.setDisplayElement(parseString(xpp));
8159    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("valueSet")) {
8160      res.setValueSetElement(parseCanonical(xpp));
8161    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
8162      res.setRelationshipElement(parseEnumeration(xpp, Enumerations.ConceptMapRelationship.NULL, new Enumerations.ConceptMapRelationshipEnumFactory()));
8163    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("otherMap")) {
8164      res.setOtherMapElement(parseCanonical(xpp));
8165    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8166      return false;
8167    }
8168    return true;
8169  }
8170
8171  protected Condition parseCondition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8172    Condition res = new Condition();
8173    parseResourceAttributes(xpp, res);
8174    next(xpp);
8175    int eventType = nextNoWhitespace(xpp);
8176    while (eventType != XmlPullParser.END_TAG) {
8177    if (!parseConditionContent(eventType, xpp, res))
8178        unknownContent(xpp);
8179      eventType = nextNoWhitespace(xpp);
8180    }
8181    next(xpp);
8182    parseElementClose(res);
8183    return res;
8184  }
8185
8186  protected boolean parseConditionContent(int eventType, XmlPullParser xpp, Condition res) throws XmlPullParserException, IOException, FHIRFormatError {
8187    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
8188      res.getIdentifier().add(parseIdentifier(xpp));
8189    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("clinicalStatus")) {
8190      res.setClinicalStatus(parseCodeableConcept(xpp));
8191    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("verificationStatus")) {
8192      res.setVerificationStatus(parseCodeableConcept(xpp));
8193    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
8194      res.getCategory().add(parseCodeableConcept(xpp));
8195    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
8196      res.setSeverity(parseCodeableConcept(xpp));
8197    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8198      res.setCode(parseCodeableConcept(xpp));
8199    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
8200      res.getBodySite().add(parseCodeableConcept(xpp));
8201    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
8202      res.setSubject(parseReference(xpp));
8203    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounter")) {
8204      res.setEncounter(parseReference(xpp));
8205    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "onset")) {
8206      res.setOnset(parseType("onset", xpp));
8207    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "abatement")) {
8208      res.setAbatement(parseType("abatement", xpp));
8209    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("recordedDate")) {
8210      res.setRecordedDateElement(parseDateTime(xpp));
8211    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participant")) {
8212      res.getParticipant().add(parseConditionParticipantComponent(xpp));
8213    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stage")) {
8214      res.getStage().add(parseConditionStageComponent(xpp));
8215    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("evidence")) {
8216      res.getEvidence().add(parseCodeableReference(xpp));
8217    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("note")) {
8218      res.getNote().add(parseAnnotation(xpp));
8219    } else if (!parseDomainResourceContent(eventType, xpp, res)){ 
8220      return false;
8221    }
8222    return true;
8223  }
8224
8225  protected Condition.ConditionParticipantComponent parseConditionParticipantComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8226    Condition.ConditionParticipantComponent res = new Condition.ConditionParticipantComponent();
8227    parseElementAttributes(xpp, res);
8228    next(xpp);
8229    int eventType = nextNoWhitespace(xpp);
8230    while (eventType != XmlPullParser.END_TAG) {
8231    if (!parseConditionParticipantComponentContent(eventType, xpp, res))
8232        unknownContent(xpp);
8233      eventType = nextNoWhitespace(xpp);
8234    }
8235    next(xpp);
8236    parseElementClose(res);
8237    return res;
8238  }
8239
8240  protected boolean parseConditionParticipantComponentContent(int eventType, XmlPullParser xpp, Condition.ConditionParticipantComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8241    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
8242      res.setFunction(parseCodeableConcept(xpp));
8243    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actor")) {
8244      res.setActor(parseReference(xpp));
8245    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8246      return false;
8247    }
8248    return true;
8249  }
8250
8251  protected Condition.ConditionStageComponent parseConditionStageComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8252    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
8253    parseElementAttributes(xpp, res);
8254    next(xpp);
8255    int eventType = nextNoWhitespace(xpp);
8256    while (eventType != XmlPullParser.END_TAG) {
8257    if (!parseConditionStageComponentContent(eventType, xpp, res))
8258        unknownContent(xpp);
8259      eventType = nextNoWhitespace(xpp);
8260    }
8261    next(xpp);
8262    parseElementClose(res);
8263    return res;
8264  }
8265
8266  protected boolean parseConditionStageComponentContent(int eventType, XmlPullParser xpp, Condition.ConditionStageComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8267    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
8268      res.setSummary(parseCodeableConcept(xpp));
8269    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assessment")) {
8270      res.getAssessment().add(parseReference(xpp));
8271    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
8272      res.setType(parseCodeableConcept(xpp));
8273    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8274      return false;
8275    }
8276    return true;
8277  }
8278
8279  protected ConditionDefinition parseConditionDefinition(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8280    ConditionDefinition res = new ConditionDefinition();
8281    parseResourceAttributes(xpp, res);
8282    next(xpp);
8283    int eventType = nextNoWhitespace(xpp);
8284    while (eventType != XmlPullParser.END_TAG) {
8285    if (!parseConditionDefinitionContent(eventType, xpp, res))
8286        unknownContent(xpp);
8287      eventType = nextNoWhitespace(xpp);
8288    }
8289    next(xpp);
8290    parseElementClose(res);
8291    return res;
8292  }
8293
8294  protected boolean parseConditionDefinitionContent(int eventType, XmlPullParser xpp, ConditionDefinition res) throws XmlPullParserException, IOException, FHIRFormatError {
8295    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) {
8296      res.setUrlElement(parseUri(xpp));
8297    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
8298      res.getIdentifier().add(parseIdentifier(xpp));
8299    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
8300      res.setVersionElement(parseString(xpp));
8301    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
8302      res.setNameElement(parseString(xpp));
8303    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
8304      res.setTitleElement(parseString(xpp));
8305    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subtitle")) {
8306      res.setSubtitleElement(parseString(xpp));
8307    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
8308      res.setStatusElement(parseEnumeration(xpp, Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
8309    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("experimental")) {
8310      res.setExperimentalElement(parseBoolean(xpp));
8311    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("date")) {
8312      res.setDateElement(parseDateTime(xpp));
8313    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("publisher")) {
8314      res.setPublisherElement(parseString(xpp));
8315    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contact")) {
8316      res.getContact().add(parseContactDetail(xpp));
8317    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
8318      res.setDescriptionElement(parseMarkdown(xpp));
8319    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("useContext")) {
8320      res.getUseContext().add(parseUsageContext(xpp));
8321    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("jurisdiction")) {
8322      res.getJurisdiction().add(parseCodeableConcept(xpp));
8323    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8324      res.setCode(parseCodeableConcept(xpp));
8325    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("severity")) {
8326      res.setSeverity(parseCodeableConcept(xpp));
8327    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("bodySite")) {
8328      res.setBodySite(parseCodeableConcept(xpp));
8329    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("stage")) {
8330      res.setStage(parseCodeableConcept(xpp));
8331    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasSeverity")) {
8332      res.setHasSeverityElement(parseBoolean(xpp));
8333    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasBodySite")) {
8334      res.setHasBodySiteElement(parseBoolean(xpp));
8335    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hasStage")) {
8336      res.setHasStageElement(parseBoolean(xpp));
8337    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("definition")) {
8338      res.getDefinition().add(parseUri(xpp));
8339    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("observation")) {
8340      res.getObservation().add(parseConditionDefinitionObservationComponent(xpp));
8341    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("medication")) {
8342      res.getMedication().add(parseConditionDefinitionMedicationComponent(xpp));
8343    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precondition")) {
8344      res.getPrecondition().add(parseConditionDefinitionPreconditionComponent(xpp));
8345    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("team")) {
8346      res.getTeam().add(parseReference(xpp));
8347    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("questionnaire")) {
8348      res.getQuestionnaire().add(parseConditionDefinitionQuestionnaireComponent(xpp));
8349    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("plan")) {
8350      res.getPlan().add(parseConditionDefinitionPlanComponent(xpp));
8351    } else if (!parseMetadataResourceContent(eventType, xpp, res)){ 
8352      return false;
8353    }
8354    return true;
8355  }
8356
8357  protected ConditionDefinition.ConditionDefinitionObservationComponent parseConditionDefinitionObservationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8358    ConditionDefinition.ConditionDefinitionObservationComponent res = new ConditionDefinition.ConditionDefinitionObservationComponent();
8359    parseElementAttributes(xpp, res);
8360    next(xpp);
8361    int eventType = nextNoWhitespace(xpp);
8362    while (eventType != XmlPullParser.END_TAG) {
8363    if (!parseConditionDefinitionObservationComponentContent(eventType, xpp, res))
8364        unknownContent(xpp);
8365      eventType = nextNoWhitespace(xpp);
8366    }
8367    next(xpp);
8368    parseElementClose(res);
8369    return res;
8370  }
8371
8372  protected boolean parseConditionDefinitionObservationComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionObservationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8373    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
8374      res.setCategory(parseCodeableConcept(xpp));
8375    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8376      res.setCode(parseCodeableConcept(xpp));
8377    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8378      return false;
8379    }
8380    return true;
8381  }
8382
8383  protected ConditionDefinition.ConditionDefinitionMedicationComponent parseConditionDefinitionMedicationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8384    ConditionDefinition.ConditionDefinitionMedicationComponent res = new ConditionDefinition.ConditionDefinitionMedicationComponent();
8385    parseElementAttributes(xpp, res);
8386    next(xpp);
8387    int eventType = nextNoWhitespace(xpp);
8388    while (eventType != XmlPullParser.END_TAG) {
8389    if (!parseConditionDefinitionMedicationComponentContent(eventType, xpp, res))
8390        unknownContent(xpp);
8391      eventType = nextNoWhitespace(xpp);
8392    }
8393    next(xpp);
8394    parseElementClose(res);
8395    return res;
8396  }
8397
8398  protected boolean parseConditionDefinitionMedicationComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionMedicationComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8399    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
8400      res.setCategory(parseCodeableConcept(xpp));
8401    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8402      res.setCode(parseCodeableConcept(xpp));
8403    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8404      return false;
8405    }
8406    return true;
8407  }
8408
8409  protected ConditionDefinition.ConditionDefinitionPreconditionComponent parseConditionDefinitionPreconditionComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8410    ConditionDefinition.ConditionDefinitionPreconditionComponent res = new ConditionDefinition.ConditionDefinitionPreconditionComponent();
8411    parseElementAttributes(xpp, res);
8412    next(xpp);
8413    int eventType = nextNoWhitespace(xpp);
8414    while (eventType != XmlPullParser.END_TAG) {
8415    if (!parseConditionDefinitionPreconditionComponentContent(eventType, xpp, res))
8416        unknownContent(xpp);
8417      eventType = nextNoWhitespace(xpp);
8418    }
8419    next(xpp);
8420    parseElementClose(res);
8421    return res;
8422  }
8423
8424  protected boolean parseConditionDefinitionPreconditionComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionPreconditionComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8425    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
8426      res.setTypeElement(parseEnumeration(xpp, ConditionDefinition.ConditionPreconditionType.NULL, new ConditionDefinition.ConditionPreconditionTypeEnumFactory()));
8427    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
8428      res.setCode(parseCodeableConcept(xpp));
8429    } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) {
8430      res.setValue(parseType("value", xpp));
8431    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8432      return false;
8433    }
8434    return true;
8435  }
8436
8437  protected ConditionDefinition.ConditionDefinitionQuestionnaireComponent parseConditionDefinitionQuestionnaireComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8438    ConditionDefinition.ConditionDefinitionQuestionnaireComponent res = new ConditionDefinition.ConditionDefinitionQuestionnaireComponent();
8439    parseElementAttributes(xpp, res);
8440    next(xpp);
8441    int eventType = nextNoWhitespace(xpp);
8442    while (eventType != XmlPullParser.END_TAG) {
8443    if (!parseConditionDefinitionQuestionnaireComponentContent(eventType, xpp, res))
8444        unknownContent(xpp);
8445      eventType = nextNoWhitespace(xpp);
8446    }
8447    next(xpp);
8448    parseElementClose(res);
8449    return res;
8450  }
8451
8452  protected boolean parseConditionDefinitionQuestionnaireComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionQuestionnaireComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8453    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
8454      res.setPurposeElement(parseEnumeration(xpp, ConditionDefinition.ConditionQuestionnairePurpose.NULL, new ConditionDefinition.ConditionQuestionnairePurposeEnumFactory()));
8455    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
8456      res.setReference(parseReference(xpp));
8457    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8458      return false;
8459    }
8460    return true;
8461  }
8462
8463  protected ConditionDefinition.ConditionDefinitionPlanComponent parseConditionDefinitionPlanComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8464    ConditionDefinition.ConditionDefinitionPlanComponent res = new ConditionDefinition.ConditionDefinitionPlanComponent();
8465    parseElementAttributes(xpp, res);
8466    next(xpp);
8467    int eventType = nextNoWhitespace(xpp);
8468    while (eventType != XmlPullParser.END_TAG) {
8469    if (!parseConditionDefinitionPlanComponentContent(eventType, xpp, res))
8470        unknownContent(xpp);
8471      eventType = nextNoWhitespace(xpp);
8472    }
8473    next(xpp);
8474    parseElementClose(res);
8475    return res;
8476  }
8477
8478  protected boolean parseConditionDefinitionPlanComponentContent(int eventType, XmlPullParser xpp, ConditionDefinition.ConditionDefinitionPlanComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
8479    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("role")) {
8480      res.setRole(parseCodeableConcept(xpp));
8481    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reference")) {
8482      res.setReference(parseReference(xpp));
8483    } else if (!parseBackboneElementContent(eventType, xpp, res)){ 
8484      return false;
8485    }
8486    return true;
8487  }
8488
8489  protected Consent parseConsent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
8490    Consent res = new Consent();
8491    parseResourceAttributes(xpp, res);
8492    next(xpp);
8493    int eventType = nextNoWhitespace(xpp);
8494    while (eventType != XmlPullParser.END_TAG) {
8495    if (!parseConsentContent(eventType, xpp, res))
8496        unknownContent(xpp);
8497      eventType = nextNoWhitespace(xpp);
8498    }
8499    next(xpp);
8500    parseElementClose(res);
8501    return res;
8502  }
8503
8504  protected boolean parseConsentContent(int eventType, XmlPullParser xpp, Consent res) throws XmlPullParserException, IOException, FHIRFormatError {
8505    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifier")) {
8506      res.getIdentifier().add(parseIdentifier(xpp));
8507    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("status")) {
8508      res.setStatusElement(parseEnumeration(xpp, Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
8509    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
8510      res.getCategory().add(parseCodeableConcept(xpp));
8511    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
8512      res.setSubject(parseReference(xpp));
8513    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dateTime")) {
8514      res.setDateTimeElement(parseDateTime(xpp));
8515    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("grantor")) {
8516      res.getGrantor().add(parseReference(xpp));
8517    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("grantee")) {
8518      res.getGrantee().add(parseReference(xpp));
8519    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("manager")) {
8520      res.getManager().add(parseReference(xpp));
8521    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("controller")) {
8522      res.getController().add(parseReference(xpp));
8523    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceAttachment")) {
8524      res.getSourceAttachment().add(parseAttachment(xpp));
8525    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sourceReference")