001package org.hl7.fhir.r5.openehr;
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 Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
034
035
036
037import org.hl7.fhir.r5.model.*;
038import org.hl7.fhir.r5.formats.*;
039import org.xmlpull.v1.*;
040import org.hl7.fhir.utilities.xml.IXMLWriter;
041import org.hl7.fhir.utilities.Utilities;
042import org.hl7.fhir.exceptions.FHIRFormatError;
043import org.hl7.fhir.exceptions.FHIRException;
044import java.io.IOException;
045import java.util.Enumeration;
046
047public class OpenehrXmlParser extends org.hl7.fhir.r5.formats.XmlParser {
048
049  public OpenehrXmlParser(boolean allowUnknownContent) {
050    super();
051    setAllowUnknownContent(allowUnknownContent);
052  }
053
054  public OpenehrXmlParser(IXMLWriter xml) {
055    super();
056    this.xml = xml;
057  }
058
059  protected ACCESS_CONTROL_SETTINGS parseACCESS_CONTROL_SETTINGS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
060    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
061    switch (type) {
062    default: throw new FHIRException("Unsupported type '"+type+"'");
063    }
064  }
065
066  protected boolean parseACCESS_CONTROL_SETTINGSContent(int eventType, XmlPullParser xpp, ACCESS_CONTROL_SETTINGS res) throws XmlPullParserException, IOException, FHIRFormatError {
067    if (!parseBaseContent(eventType, xpp, res)) { //3 
068        return false;
069    }
070    return true;
071  }
072
073  protected ACTOR parseACTOR(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
074    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
075    switch (type) {
076    case "AGENT": return parseAGENT(xpp);
077    case "GROUP": return parseGROUP(xpp);
078    case "PERSON": return parsePERSON(xpp);
079    case "ORGANISATION": return parseORGANISATION(xpp);
080    default: throw new FHIRException("Unsupported type '"+type+"'");
081    }
082  }
083
084  protected boolean parseACTORContent(int eventType, XmlPullParser xpp, ACTOR res) throws XmlPullParserException, IOException, FHIRFormatError {
085    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("languages")) {
086      res.getLanguagesList().add(parseDV_TEXT(xpp));
087    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("roles")) {
088      res.getRolesList().add(parsePARTY_REF(xpp));
089    } else if (!parsePARTYContent(eventType, xpp, res)) { //3 
090        return false;
091    }
092    return true;
093  }
094
095  protected AUTHORED_RESOURCE parseAUTHORED_RESOURCE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
096    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
097    switch (type) {
098    default: throw new FHIRException("Unsupported type '"+type+"'");
099    }
100  }
101
102  protected boolean parseAUTHORED_RESOURCEContent(int eventType, XmlPullParser xpp, AUTHORED_RESOURCE res) throws XmlPullParserException, IOException, FHIRFormatError {
103    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("original_language")) {
104      res.setOriginal_language(parseCODE_PHRASE(xpp));
105    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("is_controlled")) {
106      res.setIs_controlledElement(parseBoolean(xpp));
107    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("translations")) {
108      res.getTranslationsList().add(parseTRANSLATION_DETAILS(xpp));
109    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
110      res.setDescription(parseRESOURCE_DESCRIPTION(xpp));
111    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revision_history")) {
112      res.setRevision_history(parseREVISION_HISTORY(xpp));
113    } else if (!parseBaseContent(eventType, xpp, res)) { //3 
114        return false;
115    }
116    return true;
117  }
118
119  protected Any parseAny(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
120    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
121    switch (type) {
122    case "EHR": return parseEHR(xpp);
123    default: throw new FHIRException("Unsupported type '"+type+"'");
124    }
125  }
126
127  protected boolean parseAnyContent(int eventType, XmlPullParser xpp, Any res) throws XmlPullParserException, IOException, FHIRFormatError {
128    if (!parseBaseContent(eventType, xpp, res)) { //3 
129        return false;
130    }
131    return true;
132  }
133
134  protected CARE_ENTRY parseCARE_ENTRY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
135    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
136    switch (type) {
137    case "INSTRUCTION": return parseINSTRUCTION(xpp);
138    case "OBSERVATION": return parseOBSERVATION(xpp);
139    case "ACTION": return parseACTION(xpp);
140    case "EVALUATION": return parseEVALUATION(xpp);
141    default: throw new FHIRException("Unsupported type '"+type+"'");
142    }
143  }
144
145  protected boolean parseCARE_ENTRYContent(int eventType, XmlPullParser xpp, CARE_ENTRY res) throws XmlPullParserException, IOException, FHIRFormatError {
146    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("protocol")) {
147      res.setProtocol(parseITEM_STRUCTURE(xpp));
148    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("guideline_id")) {
149      res.setGuideline_id(parseOBJECT_REF(xpp));
150    } else if (!parseENTRYContent(eventType, xpp, res)) { //3 
151        return false;
152    }
153    return true;
154  }
155
156  protected CONTENT_ITEM parseCONTENT_ITEM(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
157    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
158    switch (type) {
159    case "SECTION": return parseSECTION(xpp);
160    default: throw new FHIRException("Unsupported type '"+type+"'");
161    }
162  }
163
164  protected boolean parseCONTENT_ITEMContent(int eventType, XmlPullParser xpp, CONTENT_ITEM res) throws XmlPullParserException, IOException, FHIRFormatError {
165    if (!parseLOCATABLEContent(eventType, xpp, res)) { //3 
166        return false;
167    }
168    return true;
169  }
170
171  protected DATA_STRUCTURE parseDATA_STRUCTURE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
172    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
173    switch (type) {
174    case "HISTORY": return parseHISTORY(xpp);
175    default: throw new FHIRException("Unsupported type '"+type+"'");
176    }
177  }
178
179  protected boolean parseDATA_STRUCTUREContent(int eventType, XmlPullParser xpp, DATA_STRUCTURE res) throws XmlPullParserException, IOException, FHIRFormatError {
180    if (!parseLOCATABLEContent(eventType, xpp, res)) { //3 
181        return false;
182    }
183    return true;
184  }
185
186  protected DATA_VALUE parseDATA_VALUE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
187    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
188    switch (type) {
189    case "DV-TEXT": return parseDV_TEXT(xpp);
190    case "DV-IDENTIFIER": return parseDV_IDENTIFIER(xpp);
191    case "DV-BOOLEAN": return parseDV_BOOLEAN(xpp);
192    case "DV-PARAGRAPH": return parseDV_PARAGRAPH(xpp);
193    case "DV-URI": return parseDV_URI(xpp);
194    case "DV-STATE": return parseDV_STATE(xpp);
195    default: throw new FHIRException("Unsupported type '"+type+"'");
196    }
197  }
198
199  protected boolean parseDATA_VALUEContent(int eventType, XmlPullParser xpp, DATA_VALUE res) throws XmlPullParserException, IOException, FHIRFormatError {
200    if (!parseBaseContent(eventType, xpp, res)) { //3 
201        return false;
202    }
203    return true;
204  }
205
206  protected DV_ABSOLUTE_QUANTITY parseDV_ABSOLUTE_QUANTITY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
207    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
208    switch (type) {
209    default: throw new FHIRException("Unsupported type '"+type+"'");
210    }
211  }
212
213  protected boolean parseDV_ABSOLUTE_QUANTITYContent(int eventType, XmlPullParser xpp, DV_ABSOLUTE_QUANTITY res) throws XmlPullParserException, IOException, FHIRFormatError {
214    if (!parseDV_QUANTIFIEDContent(eventType, xpp, res)) { //3 
215        return false;
216    }
217    return true;
218  }
219
220  protected DV_AMOUNT parseDV_AMOUNT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
221    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
222    switch (type) {
223    case "DV-DURATION": return parseDV_DURATION(xpp);
224    case "DV-COUNT": return parseDV_COUNT(xpp);
225    case "DV-PROPORTION": return parseDV_PROPORTION(xpp);
226    case "DV-QUANTITY": return parseDV_QUANTITY(xpp);
227    default: throw new FHIRException("Unsupported type '"+type+"'");
228    }
229  }
230
231  protected boolean parseDV_AMOUNTContent(int eventType, XmlPullParser xpp, DV_AMOUNT res) throws XmlPullParserException, IOException, FHIRFormatError {
232    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accuracy_is_percent")) {
233      res.setAccuracy_is_percentElement(parseBoolean(xpp));
234    } else if (!parseDV_QUANTIFIEDContent(eventType, xpp, res)) { //3 
235        return false;
236    }
237    return true;
238  }
239
240  protected DV_ENCAPSULATED parseDV_ENCAPSULATED(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
241    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
242    switch (type) {
243    case "DV-MULTIMEDIA": return parseDV_MULTIMEDIA(xpp);
244    case "DV-PARSABLE": return parseDV_PARSABLE(xpp);
245    default: throw new FHIRException("Unsupported type '"+type+"'");
246    }
247  }
248
249  protected boolean parseDV_ENCAPSULATEDContent(int eventType, XmlPullParser xpp, DV_ENCAPSULATED res) throws XmlPullParserException, IOException, FHIRFormatError {
250    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("charset")) {
251      res.setCharset(parseCODE_PHRASE(xpp));
252    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
253      res.setLanguage(parseCODE_PHRASE(xpp));
254    } else if (!parseDV_AMOUNTContent(eventType, xpp, res)) { //3 
255        return false;
256    }
257    return true;
258  }
259
260  protected DV_ORDERED parseDV_ORDERED(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
261    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
262    switch (type) {
263    case "DV-DATE-TIME": return parseDV_DATE_TIME(xpp);
264    case "DV-TIME": return parseDV_TIME(xpp);
265    case "DV-INTERVAL": return parseDV_INTERVAL(xpp);
266    case "DV-ORDINAL": return parseDV_ORDINAL(xpp);
267    case "DV-SCALE": return parseDV_SCALE(xpp);
268    default: throw new FHIRException("Unsupported type '"+type+"'");
269    }
270  }
271
272  protected boolean parseDV_ORDEREDContent(int eventType, XmlPullParser xpp, DV_ORDERED res) throws XmlPullParserException, IOException, FHIRFormatError {
273    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("normal_status")) {
274      res.setNormal_status(parseCODE_PHRASE(xpp));
275    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("normal_range")) {
276      res.setNormal_range(parseDV_INTERVAL(xpp));
277    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_reference_ranges")) {
278      res.getOther_reference_rangesList().add(parseREFERENCE_RANGE(xpp));
279    } else if (!parseDATA_VALUEContent(eventType, xpp, res)) { //3 
280        return false;
281    }
282    return true;
283  }
284
285  protected DV_QUANTIFIED parseDV_QUANTIFIED(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
286    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
287    switch (type) {
288    default: throw new FHIRException("Unsupported type '"+type+"'");
289    }
290  }
291
292  protected boolean parseDV_QUANTIFIEDContent(int eventType, XmlPullParser xpp, DV_QUANTIFIED res) throws XmlPullParserException, IOException, FHIRFormatError {
293    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("magnitude_status")) {
294      res.setMagnitude_statusElement(parseString(xpp));
295    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accuracy")) {
296      res.setAccuracy(parseBase(xpp));
297    } else if (!parseDV_ORDEREDContent(eventType, xpp, res)) { //3 
298        return false;
299    }
300    return true;
301  }
302  
303  protected DV_TEMPORAL parseDV_TEMPORAL(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
304    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
305    switch (type) {
306    case "DV-DATE": return parseDV_DATE(xpp);
307    default: throw new FHIRException("Unsupported type '"+type+"'");
308    }
309  }
310
311  protected boolean parseDV_TEMPORALContent(int eventType, XmlPullParser xpp, DV_TEMPORAL res) throws XmlPullParserException, IOException, FHIRFormatError {
312    if (!parseDV_ABSOLUTE_QUANTITYContent(eventType, xpp, res)) { //3 
313        return false;
314    }
315    return true;
316  }
317
318  protected DV_TIME_SPECIFICATION parseDV_TIME_SPECIFICATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
319    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
320    switch (type) {
321    case "DV-GENERAL-TIME-SPECIFICATION": return parseDV_GENERAL_TIME_SPECIFICATION(xpp);
322    case "DV-PERIODIC-TIME-SPECIFICATION": return parseDV_PERIODIC_TIME_SPECIFICATION(xpp);
323    default: throw new FHIRException("Unsupported type '"+type+"'");
324    }
325  }
326
327  protected boolean parseDV_TIME_SPECIFICATIONContent(int eventType, XmlPullParser xpp, DV_TIME_SPECIFICATION res) throws XmlPullParserException, IOException, FHIRFormatError {
328    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("DV_PARSABLE")) {
329      res.setDV_PARSABLEElement(parseString(xpp));
330    } else if (!parseDATA_VALUEContent(eventType, xpp, res)) { //3 
331        return false;
332    }
333    return true;
334  }
335
336  protected ENTRY parseENTRY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
337    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
338    switch (type) {
339    case "ADMIN-ENTRY": return parseADMIN_ENTRY(xpp);
340    default: throw new FHIRException("Unsupported type '"+type+"'");
341    }
342  }
343
344  protected boolean parseENTRYContent(int eventType, XmlPullParser xpp, ENTRY res) throws XmlPullParserException, IOException, FHIRFormatError {
345    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
346      res.setLanguage(parseCODE_PHRASE(xpp));
347    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encoding")) {
348      res.setEncoding(parseCODE_PHRASE(xpp));
349    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_participations")) {
350      res.getOther_participationsList().add(parsePARTICIPATION(xpp));
351    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("workflow_id")) {
352      res.setWorkflow_id(parseOBJECT_REF(xpp));
353    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
354      res.setSubject(parsePARTY_PROXY(xpp));
355    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
356      res.setProvider(parsePARTY_PROXY(xpp));
357    } else if (!parseCONTENT_ITEMContent(eventType, xpp, res)) { //3 
358        return false;
359    }
360    return true;
361  }
362
363  protected EVENT parseEVENT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
364    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
365    switch (type) {
366    case "INTERVAL-EVENT": return parseINTERVAL_EVENT(xpp);
367    case "POINT-EVENT": return parsePOINT_EVENT(xpp);
368    default: throw new FHIRException("Unsupported type '"+type+"'");
369    }
370  }
371
372  protected boolean parseEVENTContent(int eventType, XmlPullParser xpp, EVENT res) throws XmlPullParserException, IOException, FHIRFormatError {
373    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
374      res.setTime(parseDV_DATE_TIME(xpp));
375    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("state")) {
376      res.setState(parseITEM_STRUCTURE(xpp));
377    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
378      res.setData(parseAny(xpp));
379    } else if (!parseLOCATABLEContent(eventType, xpp, res)) { //3 
380        return false;
381    }
382    return true;
383  }
384
385  protected ITEM_STRUCTURE parseITEM_STRUCTURE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
386    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
387    switch (type) {
388    case "ITEM-SINGLE": return parseITEM_SINGLE(xpp);
389    case "ITEM-TREE": return parseITEM_TREE(xpp);
390    case "ITEM-TABLE": return parseITEM_TABLE(xpp);
391    case "ITEM-LIST": return parseITEM_LIST(xpp);
392    default: throw new FHIRException("Unsupported type '"+type+"'");
393    }
394  }
395
396  protected boolean parseITEM_STRUCTUREContent(int eventType, XmlPullParser xpp, ITEM_STRUCTURE res) throws XmlPullParserException, IOException, FHIRFormatError {
397    if (!parseDATA_STRUCTUREContent(eventType, xpp, res)) { //3 
398        return false;
399    }
400    return true;
401  }
402
403  protected ITEM parseITEM(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
404    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
405    switch (type) {
406    case "ELEMENT": return parseELEMENT(xpp);
407    case "CLUSTER": return parseCLUSTER(xpp);
408    default: throw new FHIRException("Unsupported type '"+type+"'");
409    }
410  }
411
412  protected boolean parseITEMContent(int eventType, XmlPullParser xpp, ITEM res) throws XmlPullParserException, IOException, FHIRFormatError {
413    if (!parseLOCATABLEContent(eventType, xpp, res)) { //3 
414        return false;
415    }
416    return true;
417  }
418
419  protected LOCATABLE parseLOCATABLE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
420    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
421    switch (type) {
422    case "CONTACT": return parseCONTACT(xpp);
423    case "EVENT-CONTEXT": return parseEVENT_CONTEXT(xpp);
424    case "EHR-STATUS": return parseEHR_STATUS(xpp);
425    case "PARTY-IDENTITY": return parsePARTY_IDENTITY(xpp);
426    case "ADDRESS": return parseADDRESS(xpp);
427    case "COMPOSITION": return parseCOMPOSITION(xpp);
428    case "PARTY-RELATIONSHIP": return parsePARTY_RELATIONSHIP(xpp);
429    case "CAPABILITY": return parseCAPABILITY(xpp);
430    case "EHR-ACCESS": return parseEHR_ACCESS(xpp);
431    case "ACTIVITY": return parseACTIVITY(xpp);
432    case "FOLDER": return parseFOLDER(xpp);
433    case "PARTICIPATION": return parsePARTICIPATION(xpp);
434    default: throw new FHIRException("Unsupported type '"+type+"'");
435    }
436  }
437
438  protected boolean parseLOCATABLEContent(int eventType, XmlPullParser xpp, LOCATABLE res) throws XmlPullParserException, IOException, FHIRFormatError {
439    if (!parsePATHABLEContent(eventType, xpp, res)) { //3 
440        return false;
441    }
442    return true;
443  }
444
445  protected OBJECT_ID parseOBJECT_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
446    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
447    switch (type) {
448    case "TEMPLATE-ID": return parseTEMPLATE_ID(xpp);
449    case "ARCHETYPE-ID": return parseARCHETYPE_ID(xpp);
450    case "GENERIC-ID": return parseGENERIC_ID(xpp);
451    case "TERMINOLOGY-ID": return parseTERMINOLOGY_ID(xpp);
452    default: throw new FHIRException("Unsupported type '"+type+"'");
453    }
454  }
455
456  protected boolean parseOBJECT_IDContent(int eventType, XmlPullParser xpp, OBJECT_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
457    if (!parseUIDContent(eventType, xpp, res)) { //3 
458        return false;
459    }
460    return true;
461  }
462
463  protected PARTY_PROXY parsePARTY_PROXY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
464    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
465    switch (type) {
466    case "PARTY-SELF": return parsePARTY_SELF(xpp);
467    case "PARTY-IDENTIFIED": return parsePARTY_IDENTIFIED(xpp);
468    default: throw new FHIRException("Unsupported type '"+type+"'");
469    }
470  }
471
472  protected boolean parsePARTY_PROXYContent(int eventType, XmlPullParser xpp, PARTY_PROXY res) throws XmlPullParserException, IOException, FHIRFormatError {
473    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("external_ref")) {
474      res.setExternal_ref(parsePARTY_REF(xpp));
475    } else if (!parseBaseContent(eventType, xpp, res)) { //3 
476        return false;
477    }
478    return true;
479  }
480
481  protected PARTY parsePARTY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
482    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
483    switch (type) {
484    case "ROLE": return parseROLE(xpp);
485    default: throw new FHIRException("Unsupported type '"+type+"'");
486    }
487  }
488
489  protected boolean parsePARTYContent(int eventType, XmlPullParser xpp, PARTY res) throws XmlPullParserException, IOException, FHIRFormatError {
490    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identities")) {
491      res.getIdentitiesList().add(parsePARTY_IDENTITY(xpp));
492    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contacts")) {
493      res.setContacts(parseCONTACT(xpp));
494    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
495      res.setDetails(parseITEM_STRUCTURE(xpp));
496    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reverse_relationships")) {
497      res.getReverse_relationshipsList().add(parseLOCATABLE_REF(xpp));
498    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationships")) {
499      res.getRelationshipsList().add(parsePARTY_RELATIONSHIP(xpp));
500    } else if (!parseLOCATABLEContent(eventType, xpp, res)) { //3 
501        return false;
502    }
503    return true;
504  }
505
506  protected PATHABLE parsePATHABLE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
507    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
508    switch (type) {
509    case "INSTRUCTION-DETAILS": return parseINSTRUCTION_DETAILS(xpp);
510    case "ISM-TRANSITION": return parseISM_TRANSITION(xpp);
511    default: throw new FHIRException("Unsupported type '"+type+"'");
512    }
513  }
514
515  protected boolean parsePATHABLEContent(int eventType, XmlPullParser xpp, PATHABLE res) throws XmlPullParserException, IOException, FHIRFormatError {
516    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
517      res.setName(parseDV_TEXT(xpp));
518    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("archetype_node_id")) {
519      res.setArchetype_node_idElement(parseString(xpp));
520    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
521      res.setUid(parseUID_BASED_ID(xpp));
522    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("links")) {
523      res.getLinksList().add(parseLINK(xpp));
524    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("archetype_details")) {
525      res.setArchetype_details(parseARCHETYPED(xpp));
526    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("feeder_audit")) {
527      res.setFeeder_audit(parseFEEDER_AUDIT(xpp));
528    } else if (!parseAnyContent(eventType, xpp, res)) { //3 
529        return false;
530    }
531    return true;
532  }
533
534  protected UID_BASED_ID parseUID_BASED_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
535    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
536    switch (type) {
537    case "OBJECT-VERSION-ID": return parseOBJECT_VERSION_ID(xpp);
538    case "HIER-OBJECT-ID": return parseHIER_OBJECT_ID(xpp);
539    default: throw new FHIRException("Unsupported type '"+type+"'");
540    }
541  }
542
543  protected boolean parseUID_BASED_IDContent(int eventType, XmlPullParser xpp, UID_BASED_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
544    if (!parseOBJECT_IDContent(eventType, xpp, res)) { //3 
545        return false;
546    }
547    return true;
548  }
549
550  protected UID parseUID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
551    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
552    switch (type) {
553    case "ISO-OID": return parseISO_OID(xpp);
554    case "UUID": return parseUUID(xpp);
555    case "INTERNET-ID": return parseINTERNET_ID(xpp);
556    default: throw new FHIRException("Unsupported type '"+type+"'");
557    }
558  }
559
560  protected boolean parseUIDContent(int eventType, XmlPullParser xpp, UID res) throws XmlPullParserException, IOException, FHIRFormatError {
561    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
562      res.setValueElement(parseString(xpp));
563    } else if (!parseBaseContent(eventType, xpp, res)) { //3 
564        return false;
565    }
566    return true;
567  }
568
569  protected VERSION parseVERSION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
570    String type = xpp.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
571    switch (type) {
572    case "IMPORTED-VERSION": return parseIMPORTED_VERSION(xpp);
573    case "ORIGINAL-VERSION": return parseORIGINAL_VERSION(xpp);
574    default: throw new FHIRException("Unsupported type '"+type+"'");
575    }
576  }
577
578  protected boolean parseVERSIONContent(int eventType, XmlPullParser xpp, VERSION res) throws XmlPullParserException, IOException, FHIRFormatError {
579    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contribution")) {
580      res.setContribution(parseOBJECT_REF(xpp));
581    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("signature")) {
582      res.setSignatureElement(parseString(xpp));
583    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("commit_audit")) {
584      res.setCommit_audit(parseAUDIT_DETAILS(xpp));
585    } else if (!parseBaseContent(eventType, xpp, res)) { //3 
586        return false;
587    }
588    return true;
589  }
590
591  protected ACTION parseACTION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
592    ACTION res = new ACTION();
593    next(xpp);
594    int eventType = nextNoWhitespace(xpp);
595    while (eventType != XmlPullParser.END_TAG) {
596    if (!parseACTIONContent(eventType, xpp, res)) // 1
597        unknownContent(xpp);
598      eventType = nextNoWhitespace(xpp);
599    }
600    next(xpp);
601    parseElementClose(res);
602    return res;
603  }
604
605  protected boolean parseACTIONContent(int eventType, XmlPullParser xpp, ACTION res) throws XmlPullParserException, IOException, FHIRFormatError {
606    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
607      res.setTime(parseDV_DATE_TIME(xpp));
608    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ism_transition")) {
609      res.setIsm_transition(parseISM_TRANSITION(xpp));
610    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instruction_details")) {
611      res.setInstruction_details(parseINSTRUCTION_DETAILS(xpp));
612    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
613      res.setDescription(parseITEM_STRUCTURE(xpp));
614    } else if (!parseCARE_ENTRYContent(eventType, xpp, res)){ //2
615      return false;
616    }
617    return true;
618  }
619
620  protected ACTIVITY parseACTIVITY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
621    ACTIVITY res = new ACTIVITY();
622    next(xpp);
623    int eventType = nextNoWhitespace(xpp);
624    while (eventType != XmlPullParser.END_TAG) {
625    if (!parseACTIVITYContent(eventType, xpp, res)) // 1
626        unknownContent(xpp);
627      eventType = nextNoWhitespace(xpp);
628    }
629    next(xpp);
630    parseElementClose(res);
631    return res;
632  }
633
634  protected boolean parseACTIVITYContent(int eventType, XmlPullParser xpp, ACTIVITY res) throws XmlPullParserException, IOException, FHIRFormatError {
635    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("timing")) {
636      res.setTiming(parseDV_PARSABLE(xpp));
637    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("action_archetype_id")) {
638      res.setAction_archetype_idElement(parseString(xpp));
639    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
640      res.setDescription(parseITEM_STRUCTURE(xpp));
641    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
642      return false;
643    }
644    return true;
645  }
646
647  protected ADDRESS parseADDRESS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
648    ADDRESS res = new ADDRESS();
649    next(xpp);
650    int eventType = nextNoWhitespace(xpp);
651    while (eventType != XmlPullParser.END_TAG) {
652    if (!parseADDRESSContent(eventType, xpp, res)) // 1
653        unknownContent(xpp);
654      eventType = nextNoWhitespace(xpp);
655    }
656    next(xpp);
657    parseElementClose(res);
658    return res;
659  }
660
661  protected boolean parseADDRESSContent(int eventType, XmlPullParser xpp, ADDRESS res) throws XmlPullParserException, IOException, FHIRFormatError {
662    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
663      res.setDetails(parseITEM_STRUCTURE(xpp));
664    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
665      return false;
666    }
667    return true;
668  }
669
670  protected ADMIN_ENTRY parseADMIN_ENTRY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
671    ADMIN_ENTRY res = new ADMIN_ENTRY();
672    next(xpp);
673    int eventType = nextNoWhitespace(xpp);
674    while (eventType != XmlPullParser.END_TAG) {
675    if (!parseADMIN_ENTRYContent(eventType, xpp, res)) // 1
676        unknownContent(xpp);
677      eventType = nextNoWhitespace(xpp);
678    }
679    next(xpp);
680    parseElementClose(res);
681    return res;
682  }
683
684  protected boolean parseADMIN_ENTRYContent(int eventType, XmlPullParser xpp, ADMIN_ENTRY res) throws XmlPullParserException, IOException, FHIRFormatError {
685    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
686      res.setData(parseITEM_STRUCTURE(xpp));
687    } else if (!parseENTRYContent(eventType, xpp, res)){ //2
688      return false;
689    }
690    return true;
691  }
692
693  protected AGENT parseAGENT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
694    AGENT res = new AGENT();
695    next(xpp);
696    int eventType = nextNoWhitespace(xpp);
697    while (eventType != XmlPullParser.END_TAG) {
698    if (!parseAGENTContent(eventType, xpp, res)) // 1
699        unknownContent(xpp);
700      eventType = nextNoWhitespace(xpp);
701    }
702    next(xpp);
703    parseElementClose(res);
704    return res;
705  }
706
707  protected boolean parseAGENTContent(int eventType, XmlPullParser xpp, AGENT res) throws XmlPullParserException, IOException, FHIRFormatError {
708    if (!parseACTORContent(eventType, xpp, res)){ //2
709      return false;
710    }
711    return true;
712  }
713
714  protected ARCHETYPE_ID parseARCHETYPE_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
715    ARCHETYPE_ID res = new ARCHETYPE_ID();
716    next(xpp);
717    int eventType = nextNoWhitespace(xpp);
718    while (eventType != XmlPullParser.END_TAG) {
719    if (!parseARCHETYPE_IDContent(eventType, xpp, res)) // 1
720        unknownContent(xpp);
721      eventType = nextNoWhitespace(xpp);
722    }
723    next(xpp);
724    parseElementClose(res);
725    return res;
726  }
727
728  protected boolean parseARCHETYPE_IDContent(int eventType, XmlPullParser xpp, ARCHETYPE_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
729    if (!parseOBJECT_IDContent(eventType, xpp, res)){ //2
730      return false;
731    }
732    return true;
733  }
734
735  protected ARCHETYPED parseARCHETYPED(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
736    ARCHETYPED res = new ARCHETYPED();
737    next(xpp);
738    int eventType = nextNoWhitespace(xpp);
739    while (eventType != XmlPullParser.END_TAG) {
740    if (!parseARCHETYPEDContent(eventType, xpp, res)) // 1
741        unknownContent(xpp);
742      eventType = nextNoWhitespace(xpp);
743    }
744    next(xpp);
745    parseElementClose(res);
746    return res;
747  }
748
749  protected boolean parseARCHETYPEDContent(int eventType, XmlPullParser xpp, ARCHETYPED res) throws XmlPullParserException, IOException, FHIRFormatError {
750    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("archetype_id")) {
751      res.setArchetype_id(parseARCHETYPE_ID(xpp));
752    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("template_id")) {
753      res.setTemplate_id(parseTEMPLATE_ID(xpp));
754    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rm_version")) {
755      res.setRm_versionElement(parseString(xpp));
756    } else if (!parseBaseContent(eventType, xpp, res)){ //2
757      return false;
758    }
759    return true;
760  }
761
762  protected ATTESTATION parseATTESTATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
763    ATTESTATION res = new ATTESTATION();
764    next(xpp);
765    int eventType = nextNoWhitespace(xpp);
766    while (eventType != XmlPullParser.END_TAG) {
767    if (!parseATTESTATIONContent(eventType, xpp, res)) // 1
768        unknownContent(xpp);
769      eventType = nextNoWhitespace(xpp);
770    }
771    next(xpp);
772    parseElementClose(res);
773    return res;
774  }
775
776  protected boolean parseATTESTATIONContent(int eventType, XmlPullParser xpp, ATTESTATION res) throws XmlPullParserException, IOException, FHIRFormatError {
777    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attested_view")) {
778      res.setAttested_view(parseDV_MULTIMEDIA(xpp));
779    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("proof")) {
780      res.setProofElement(parseString(xpp));
781    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("items")) {
782      res.getItemsList().add(parseDV_EHR_URI(xpp));
783    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
784      res.setReason(parseDV_TEXT(xpp));
785    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("is_pending")) {
786      res.setIs_pendingElement(parseBoolean(xpp));
787    } else if (!parseAUDIT_DETAILSContent(eventType, xpp, res)){ //2
788      return false;
789    }
790    return true;
791  }
792
793  protected AUDIT_DETAILS parseAUDIT_DETAILS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
794    AUDIT_DETAILS res = new AUDIT_DETAILS();
795    next(xpp);
796    int eventType = nextNoWhitespace(xpp);
797    while (eventType != XmlPullParser.END_TAG) {
798    if (!parseAUDIT_DETAILSContent(eventType, xpp, res)) // 1
799        unknownContent(xpp);
800      eventType = nextNoWhitespace(xpp);
801    }
802    next(xpp);
803    parseElementClose(res);
804    return res;
805  }
806
807  protected boolean parseAUDIT_DETAILSContent(int eventType, XmlPullParser xpp, AUDIT_DETAILS res) throws XmlPullParserException, IOException, FHIRFormatError {
808    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system_id")) {
809      res.setSystem_idElement(parseString(xpp));
810    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time_committed")) {
811      res.setTime_committed(parseDV_DATE_TIME(xpp));
812    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("change_type")) {
813      res.setChange_type(parseDV_CODED_TEXT(xpp));
814    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) {
815      res.setDescription(parseDV_TEXT(xpp));
816    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("committer")) {
817      res.setCommitter(parsePARTY_PROXY(xpp));
818    } else if (!parseBaseContent(eventType, xpp, res)){ //2
819      return false;
820    }
821    return true;
822  }
823
824  protected Annotations parseAnnotations(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
825    Annotations res = new Annotations();
826    next(xpp);
827    int eventType = nextNoWhitespace(xpp);
828    while (eventType != XmlPullParser.END_TAG) {
829    if (!parseAnnotationsContent(eventType, xpp, res)) // 1
830        unknownContent(xpp);
831      eventType = nextNoWhitespace(xpp);
832    }
833    next(xpp);
834    parseElementClose(res);
835    return res;
836  }
837
838  protected boolean parseAnnotationsContent(int eventType, XmlPullParser xpp, Annotations res) throws XmlPullParserException, IOException, FHIRFormatError {
839    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("comment")) {
840      res.setCommentElement(parseString(xpp));
841    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhir_mapping")) {
842      res.setFhir_mappingElement(parseString(xpp));
843    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("vset_description")) {
844      res.setVset_descriptionElement(parseString(xpp));
845    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hl7v2_mapping")) {
846      res.setHl7v2_mappingElement(parseString(xpp));
847    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("visibleInView")) {
848      res.setVisibleInViewElement(parseString(xpp));
849    } else if (!parseBaseContent(eventType, xpp, res)){ //2
850      return false;
851    }
852    return true;
853  }
854
855  protected CAPABILITY parseCAPABILITY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
856    CAPABILITY res = new CAPABILITY();
857    next(xpp);
858    int eventType = nextNoWhitespace(xpp);
859    while (eventType != XmlPullParser.END_TAG) {
860    if (!parseCAPABILITYContent(eventType, xpp, res)) // 1
861        unknownContent(xpp);
862      eventType = nextNoWhitespace(xpp);
863    }
864    next(xpp);
865    parseElementClose(res);
866    return res;
867  }
868
869  protected boolean parseCAPABILITYContent(int eventType, XmlPullParser xpp, CAPABILITY res) throws XmlPullParserException, IOException, FHIRFormatError {
870    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("credentials")) {
871      res.setCredentials(parseITEM_STRUCTURE(xpp));
872    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time_validity")) {
873      res.setTime_validity(parseDV_INTERVAL(xpp));
874    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
875      return false;
876    }
877    return true;
878  }
879
880  protected CLUSTER parseCLUSTER(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
881    CLUSTER res = new CLUSTER();
882    next(xpp);
883    int eventType = nextNoWhitespace(xpp);
884    while (eventType != XmlPullParser.END_TAG) {
885    if (!parseCLUSTERContent(eventType, xpp, res)) // 1
886        unknownContent(xpp);
887      eventType = nextNoWhitespace(xpp);
888    }
889    next(xpp);
890    parseElementClose(res);
891    return res;
892  }
893
894  protected boolean parseCLUSTERContent(int eventType, XmlPullParser xpp, CLUSTER res) throws XmlPullParserException, IOException, FHIRFormatError {
895    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("items")) {
896      res.getItemsList().add(parseITEM(xpp));
897    } else if (!parseITEMContent(eventType, xpp, res)){ //2
898      return false;
899    }
900    return true;
901  }
902
903  protected CODE_PHRASE parseCODE_PHRASE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
904    CODE_PHRASE res = new CODE_PHRASE();
905    next(xpp);
906    int eventType = nextNoWhitespace(xpp);
907    while (eventType != XmlPullParser.END_TAG) {
908    if (!parseCODE_PHRASEContent(eventType, xpp, res)) // 1
909        unknownContent(xpp);
910      eventType = nextNoWhitespace(xpp);
911    }
912    next(xpp);
913    parseElementClose(res);
914    return res;
915  }
916
917  protected boolean parseCODE_PHRASEContent(int eventType, XmlPullParser xpp, CODE_PHRASE res) throws XmlPullParserException, IOException, FHIRFormatError {
918    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("terminology_id")) {
919      res.setTerminology_id(parseTERMINOLOGY_ID(xpp));
920    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code_string")) {
921      res.setCode_stringElement(parseString(xpp));
922    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preferred_term")) {
923      res.setPreferred_termElement(parseString(xpp));
924    } else if (!parseBaseContent(eventType, xpp, res)){ //2
925      return false;
926    }
927    return true;
928  }
929
930  protected COMPOSITION parseCOMPOSITION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
931    COMPOSITION res = new COMPOSITION();
932    next(xpp);
933    int eventType = nextNoWhitespace(xpp);
934    while (eventType != XmlPullParser.END_TAG) {
935    if (!parseCOMPOSITIONContent(eventType, xpp, res)) // 1
936        unknownContent(xpp);
937      eventType = nextNoWhitespace(xpp);
938    }
939    next(xpp);
940    parseElementClose(res);
941    return res;
942  }
943
944  protected boolean parseCOMPOSITIONContent(int eventType, XmlPullParser xpp, COMPOSITION res) throws XmlPullParserException, IOException, FHIRFormatError {
945    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
946      res.setLanguage(parseCODE_PHRASE(xpp));
947    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("territory")) {
948      res.setTerritory(parseCODE_PHRASE(xpp));
949    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
950      res.setCategory(parseDV_CODED_TEXT(xpp));
951    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) {
952      res.setContext(parseEVENT_CONTEXT(xpp));
953    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("composer")) {
954      res.setComposer(parsePARTY_PROXY(xpp));
955    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
956      res.getContentList().add(parseCONTENT_ITEM(xpp));
957    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
958      return false;
959    }
960    return true;
961  }
962
963  protected CONTACT parseCONTACT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
964    CONTACT res = new CONTACT();
965    next(xpp);
966    int eventType = nextNoWhitespace(xpp);
967    while (eventType != XmlPullParser.END_TAG) {
968    if (!parseCONTACTContent(eventType, xpp, res)) // 1
969        unknownContent(xpp);
970      eventType = nextNoWhitespace(xpp);
971    }
972    next(xpp);
973    parseElementClose(res);
974    return res;
975  }
976
977  protected boolean parseCONTACTContent(int eventType, XmlPullParser xpp, CONTACT res) throws XmlPullParserException, IOException, FHIRFormatError {
978    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("addresses")) {
979      res.getAddressesList().add(parseADDRESS(xpp));
980    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time_validity")) {
981      res.setTime_validity(parseDV_INTERVAL(xpp));
982    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
983      return false;
984    }
985    return true;
986  }
987
988  protected CONTRIBUTION parseCONTRIBUTION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
989    CONTRIBUTION res = new CONTRIBUTION();
990    next(xpp);
991    int eventType = nextNoWhitespace(xpp);
992    while (eventType != XmlPullParser.END_TAG) {
993    if (!parseCONTRIBUTIONContent(eventType, xpp, res)) // 1
994        unknownContent(xpp);
995      eventType = nextNoWhitespace(xpp);
996    }
997    next(xpp);
998    parseElementClose(res);
999    return res;
1000  }
1001
1002  protected boolean parseCONTRIBUTIONContent(int eventType, XmlPullParser xpp, CONTRIBUTION res) throws XmlPullParserException, IOException, FHIRFormatError {
1003    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
1004      res.setUid(parseHIER_OBJECT_ID(xpp));
1005    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("versions")) {
1006      res.getVersionsList().add(parseOBJECT_REF(xpp));
1007    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("audit")) {
1008      res.setAudit(parseAUDIT_DETAILS(xpp));
1009    } else if (!parseBaseContent(eventType, xpp, res)){ //2
1010      return false;
1011    }
1012    return true;
1013  }
1014
1015  protected DV_BOOLEAN parseDV_BOOLEAN(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1016    DV_BOOLEAN res = new DV_BOOLEAN();
1017    next(xpp);
1018    int eventType = nextNoWhitespace(xpp);
1019    while (eventType != XmlPullParser.END_TAG) {
1020    if (!parseDV_BOOLEANContent(eventType, xpp, res)) // 1
1021        unknownContent(xpp);
1022      eventType = nextNoWhitespace(xpp);
1023    }
1024    next(xpp);
1025    parseElementClose(res);
1026    return res;
1027  }
1028
1029  protected boolean parseDV_BOOLEANContent(int eventType, XmlPullParser xpp, DV_BOOLEAN res) throws XmlPullParserException, IOException, FHIRFormatError {
1030    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1031      res.setValueElement(parseBoolean(xpp));
1032    } else if (!parseDATA_VALUEContent(eventType, xpp, res)){ //2
1033      return false;
1034    }
1035    return true;
1036  }
1037
1038  protected DV_CODED_TEXT parseDV_CODED_TEXT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1039    DV_CODED_TEXT res = new DV_CODED_TEXT();
1040    next(xpp);
1041    int eventType = nextNoWhitespace(xpp);
1042    while (eventType != XmlPullParser.END_TAG) {
1043    if (!parseDV_CODED_TEXTContent(eventType, xpp, res)) // 1
1044        unknownContent(xpp);
1045      eventType = nextNoWhitespace(xpp);
1046    }
1047    next(xpp);
1048    parseElementClose(res);
1049    return res;
1050  }
1051
1052  protected boolean parseDV_CODED_TEXTContent(int eventType, XmlPullParser xpp, DV_CODED_TEXT res) throws XmlPullParserException, IOException, FHIRFormatError {
1053    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("defining_code")) {
1054      res.setDefining_code(parseCODE_PHRASE(xpp));
1055    } else if (!parseDV_TEXTContent(eventType, xpp, res)){ //2
1056      return false;
1057    }
1058    return true;
1059  }
1060
1061  protected DV_COUNT parseDV_COUNT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1062    DV_COUNT res = new DV_COUNT();
1063    next(xpp);
1064    int eventType = nextNoWhitespace(xpp);
1065    while (eventType != XmlPullParser.END_TAG) {
1066    if (!parseDV_COUNTContent(eventType, xpp, res)) // 1
1067        unknownContent(xpp);
1068      eventType = nextNoWhitespace(xpp);
1069    }
1070    next(xpp);
1071    parseElementClose(res);
1072    return res;
1073  }
1074
1075  protected boolean parseDV_COUNTContent(int eventType, XmlPullParser xpp, DV_COUNT res) throws XmlPullParserException, IOException, FHIRFormatError {
1076    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("magnitude")) {
1077      res.setMagnitudeElement(parseDecimal(xpp));
1078    } else if (!parseDV_AMOUNTContent(eventType, xpp, res)){ //2
1079      return false;
1080    }
1081    return true;
1082  }
1083
1084  protected DV_DATE_TIME parseDV_DATE_TIME(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1085    DV_DATE_TIME res = new DV_DATE_TIME();
1086    next(xpp);
1087    int eventType = nextNoWhitespace(xpp);
1088    while (eventType != XmlPullParser.END_TAG) {
1089    if (!parseDV_DATE_TIMEContent(eventType, xpp, res)) // 1
1090        unknownContent(xpp);
1091      eventType = nextNoWhitespace(xpp);
1092    }
1093    next(xpp);
1094    parseElementClose(res);
1095    return res;
1096  }
1097
1098  protected boolean parseDV_DATE_TIMEContent(int eventType, XmlPullParser xpp, DV_DATE_TIME res) throws XmlPullParserException, IOException, FHIRFormatError {
1099    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1100      res.setValueElement(parseDateTime(xpp));
1101    } else if (!parseDV_ORDEREDContent(eventType, xpp, res)){ //2
1102      return false;
1103    }
1104    return true;
1105  }
1106
1107  protected DV_DATE parseDV_DATE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1108    DV_DATE res = new DV_DATE();
1109    next(xpp);
1110    int eventType = nextNoWhitespace(xpp);
1111    while (eventType != XmlPullParser.END_TAG) {
1112    if (!parseDV_DATEContent(eventType, xpp, res)) // 1
1113        unknownContent(xpp);
1114      eventType = nextNoWhitespace(xpp);
1115    }
1116    next(xpp);
1117    parseElementClose(res);
1118    return res;
1119  }
1120
1121  protected boolean parseDV_DATEContent(int eventType, XmlPullParser xpp, DV_DATE res) throws XmlPullParserException, IOException, FHIRFormatError {
1122    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1123      res.setValueElement(parseDateTime(xpp));
1124    } else if (!parseDV_TEMPORALContent(eventType, xpp, res)){ //2
1125      return false;
1126    }
1127    return true;
1128  }
1129
1130  protected DV_DURATION parseDV_DURATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1131    DV_DURATION res = new DV_DURATION();
1132    next(xpp);
1133    int eventType = nextNoWhitespace(xpp);
1134    while (eventType != XmlPullParser.END_TAG) {
1135    if (!parseDV_DURATIONContent(eventType, xpp, res)) // 1
1136        unknownContent(xpp);
1137      eventType = nextNoWhitespace(xpp);
1138    }
1139    next(xpp);
1140    parseElementClose(res);
1141    return res;
1142  }
1143
1144  protected boolean parseDV_DURATIONContent(int eventType, XmlPullParser xpp, DV_DURATION res) throws XmlPullParserException, IOException, FHIRFormatError {
1145    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1146      res.setValueElement(parseString(xpp));
1147    } else if (!parseDV_AMOUNTContent(eventType, xpp, res)){ //2
1148      return false;
1149    }
1150    return true;
1151  }
1152
1153  protected DV_EHR_URI parseDV_EHR_URI(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1154    DV_EHR_URI res = new DV_EHR_URI();
1155    next(xpp);
1156    int eventType = nextNoWhitespace(xpp);
1157    while (eventType != XmlPullParser.END_TAG) {
1158    if (!parseDV_EHR_URIContent(eventType, xpp, res)) // 1
1159        unknownContent(xpp);
1160      eventType = nextNoWhitespace(xpp);
1161    }
1162    next(xpp);
1163    parseElementClose(res);
1164    return res;
1165  }
1166
1167  protected boolean parseDV_EHR_URIContent(int eventType, XmlPullParser xpp, DV_EHR_URI res) throws XmlPullParserException, IOException, FHIRFormatError {
1168    if (!parseDV_URIContent(eventType, xpp, res)){ //2
1169      return false;
1170    }
1171    return true;
1172  }
1173
1174  protected DV_GENERAL_TIME_SPECIFICATION parseDV_GENERAL_TIME_SPECIFICATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1175    DV_GENERAL_TIME_SPECIFICATION res = new DV_GENERAL_TIME_SPECIFICATION();
1176    next(xpp);
1177    int eventType = nextNoWhitespace(xpp);
1178    while (eventType != XmlPullParser.END_TAG) {
1179    if (!parseDV_GENERAL_TIME_SPECIFICATIONContent(eventType, xpp, res)) // 1
1180        unknownContent(xpp);
1181      eventType = nextNoWhitespace(xpp);
1182    }
1183    next(xpp);
1184    parseElementClose(res);
1185    return res;
1186  }
1187
1188  protected boolean parseDV_GENERAL_TIME_SPECIFICATIONContent(int eventType, XmlPullParser xpp, DV_GENERAL_TIME_SPECIFICATION res) throws XmlPullParserException, IOException, FHIRFormatError {
1189    if (!parseDV_TIME_SPECIFICATIONContent(eventType, xpp, res)){ //2
1190      return false;
1191    }
1192    return true;
1193  }
1194
1195  protected DV_IDENTIFIER parseDV_IDENTIFIER(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1196    DV_IDENTIFIER res = new DV_IDENTIFIER();
1197    next(xpp);
1198    int eventType = nextNoWhitespace(xpp);
1199    while (eventType != XmlPullParser.END_TAG) {
1200    if (!parseDV_IDENTIFIERContent(eventType, xpp, res)) // 1
1201        unknownContent(xpp);
1202      eventType = nextNoWhitespace(xpp);
1203    }
1204    next(xpp);
1205    parseElementClose(res);
1206    return res;
1207  }
1208
1209  protected boolean parseDV_IDENTIFIERContent(int eventType, XmlPullParser xpp, DV_IDENTIFIER res) throws XmlPullParserException, IOException, FHIRFormatError {
1210    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("issuer")) {
1211      res.setIssuerElement(parseString(xpp));
1212    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("assigner")) {
1213      res.setAssignerElement(parseString(xpp));
1214    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("id")) {
1215      res.setIdElement(parseString(xpp));
1216    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1217      res.setTypeElement(parseString(xpp));
1218    } else if (!parseDATA_VALUEContent(eventType, xpp, res)){ //2
1219      return false;
1220    }
1221    return true;
1222  }
1223
1224  protected DV_INTERVAL parseDV_INTERVAL(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1225    DV_INTERVAL res = new DV_INTERVAL();
1226    next(xpp);
1227    int eventType = nextNoWhitespace(xpp);
1228    while (eventType != XmlPullParser.END_TAG) {
1229    if (!parseDV_INTERVALContent(eventType, xpp, res)) // 1
1230        unknownContent(xpp);
1231      eventType = nextNoWhitespace(xpp);
1232    }
1233    next(xpp);
1234    parseElementClose(res);
1235    return res;
1236  }
1237
1238  protected boolean parseDV_INTERVALContent(int eventType, XmlPullParser xpp, DV_INTERVAL res) throws XmlPullParserException, IOException, FHIRFormatError {
1239    if (!parseDV_ORDEREDContent(eventType, xpp, res)){ //2
1240      return false;
1241    }
1242    return true;
1243  }
1244
1245  protected DV_MULTIMEDIA parseDV_MULTIMEDIA(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1246    DV_MULTIMEDIA res = new DV_MULTIMEDIA();
1247    next(xpp);
1248    int eventType = nextNoWhitespace(xpp);
1249    while (eventType != XmlPullParser.END_TAG) {
1250    if (!parseDV_MULTIMEDIAContent(eventType, xpp, res)) // 1
1251        unknownContent(xpp);
1252      eventType = nextNoWhitespace(xpp);
1253    }
1254    next(xpp);
1255    parseElementClose(res);
1256    return res;
1257  }
1258
1259  protected boolean parseDV_MULTIMEDIAContent(int eventType, XmlPullParser xpp, DV_MULTIMEDIA res) throws XmlPullParserException, IOException, FHIRFormatError {
1260    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("alternate_text")) {
1261      res.setAlternate_textElement(parseString(xpp));
1262    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri")) {
1263      res.setUri(parseDV_URI(xpp));
1264    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
1265      res.setDataElement(parseBase64Binary(xpp));
1266    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("media_type")) {
1267      res.setMedia_type(parseCODE_PHRASE(xpp));
1268    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compression_algorithm")) {
1269      res.setCompression_algorithm(parseCODE_PHRASE(xpp));
1270    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("integrity_check")) {
1271      res.setIntegrity_checkElement(parseBase64Binary(xpp));
1272    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("integrity_check_algorithm")) {
1273      res.setIntegrity_check_algorithm(parseCODE_PHRASE(xpp));
1274    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("thumbnail")) {
1275      res.setThumbnail(parseDV_MULTIMEDIA(xpp));
1276    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("size")) {
1277      res.setSizeElement(parseInteger(xpp));
1278    } else if (!parseDV_ENCAPSULATEDContent(eventType, xpp, res)){ //2
1279      return false;
1280    }
1281    return true;
1282  }
1283
1284  protected DV_ORDINAL parseDV_ORDINAL(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1285    DV_ORDINAL res = new DV_ORDINAL();
1286    next(xpp);
1287    int eventType = nextNoWhitespace(xpp);
1288    while (eventType != XmlPullParser.END_TAG) {
1289    if (!parseDV_ORDINALContent(eventType, xpp, res)) // 1
1290        unknownContent(xpp);
1291      eventType = nextNoWhitespace(xpp);
1292    }
1293    next(xpp);
1294    parseElementClose(res);
1295    return res;
1296  }
1297
1298  protected boolean parseDV_ORDINALContent(int eventType, XmlPullParser xpp, DV_ORDINAL res) throws XmlPullParserException, IOException, FHIRFormatError {
1299    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("symbol")) {
1300      res.setSymbol(parseDV_CODED_TEXT(xpp));
1301    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1302      res.setValueElement(parseInteger(xpp));
1303    } else if (!parseDV_ORDEREDContent(eventType, xpp, res)){ //2
1304      return false;
1305    }
1306    return true;
1307  }
1308
1309  protected DV_PARAGRAPH parseDV_PARAGRAPH(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1310    DV_PARAGRAPH res = new DV_PARAGRAPH();
1311    next(xpp);
1312    int eventType = nextNoWhitespace(xpp);
1313    while (eventType != XmlPullParser.END_TAG) {
1314    if (!parseDV_PARAGRAPHContent(eventType, xpp, res)) // 1
1315        unknownContent(xpp);
1316      eventType = nextNoWhitespace(xpp);
1317    }
1318    next(xpp);
1319    parseElementClose(res);
1320    return res;
1321  }
1322
1323  protected boolean parseDV_PARAGRAPHContent(int eventType, XmlPullParser xpp, DV_PARAGRAPH res) throws XmlPullParserException, IOException, FHIRFormatError {
1324    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("items")) {
1325      res.getItemsList().add(parseDV_TEXT(xpp));
1326    } else if (!parseDATA_VALUEContent(eventType, xpp, res)){ //2
1327      return false;
1328    }
1329    return true;
1330  }
1331
1332  protected DV_PARSABLE parseDV_PARSABLE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1333    DV_PARSABLE res = new DV_PARSABLE();
1334    next(xpp);
1335    int eventType = nextNoWhitespace(xpp);
1336    while (eventType != XmlPullParser.END_TAG) {
1337    if (!parseDV_PARSABLEContent(eventType, xpp, res)) // 1
1338        unknownContent(xpp);
1339      eventType = nextNoWhitespace(xpp);
1340    }
1341    next(xpp);
1342    parseElementClose(res);
1343    return res;
1344  }
1345
1346  protected boolean parseDV_PARSABLEContent(int eventType, XmlPullParser xpp, DV_PARSABLE res) throws XmlPullParserException, IOException, FHIRFormatError {
1347    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1348      res.setValueElement(parseString(xpp));
1349    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("formalism")) {
1350      res.setFormalismElement(parseString(xpp));
1351    } else if (!parseDV_ENCAPSULATEDContent(eventType, xpp, res)){ //2
1352      return false;
1353    }
1354    return true;
1355  }
1356
1357  protected DV_PERIODIC_TIME_SPECIFICATION parseDV_PERIODIC_TIME_SPECIFICATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1358    DV_PERIODIC_TIME_SPECIFICATION res = new DV_PERIODIC_TIME_SPECIFICATION();
1359    next(xpp);
1360    int eventType = nextNoWhitespace(xpp);
1361    while (eventType != XmlPullParser.END_TAG) {
1362    if (!parseDV_PERIODIC_TIME_SPECIFICATIONContent(eventType, xpp, res)) // 1
1363        unknownContent(xpp);
1364      eventType = nextNoWhitespace(xpp);
1365    }
1366    next(xpp);
1367    parseElementClose(res);
1368    return res;
1369  }
1370
1371  protected boolean parseDV_PERIODIC_TIME_SPECIFICATIONContent(int eventType, XmlPullParser xpp, DV_PERIODIC_TIME_SPECIFICATION res) throws XmlPullParserException, IOException, FHIRFormatError {
1372    if (!parseDV_TIME_SPECIFICATIONContent(eventType, xpp, res)){ //2
1373      return false;
1374    }
1375    return true;
1376  }
1377
1378  protected DV_PROPORTION parseDV_PROPORTION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1379    DV_PROPORTION res = new DV_PROPORTION();
1380    next(xpp);
1381    int eventType = nextNoWhitespace(xpp);
1382    while (eventType != XmlPullParser.END_TAG) {
1383    if (!parseDV_PROPORTIONContent(eventType, xpp, res)) // 1
1384        unknownContent(xpp);
1385      eventType = nextNoWhitespace(xpp);
1386    }
1387    next(xpp);
1388    parseElementClose(res);
1389    return res;
1390  }
1391
1392  protected boolean parseDV_PROPORTIONContent(int eventType, XmlPullParser xpp, DV_PROPORTION res) throws XmlPullParserException, IOException, FHIRFormatError {
1393    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("numerator")) {
1394      res.setNumeratorElement(parseDecimal(xpp));
1395    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("denominator")) {
1396      res.setDenominatorElement(parseDecimal(xpp));
1397    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
1398      res.setTypeElement(parseCode(xpp));
1399    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precision")) {
1400      res.setPrecisionElement(parseInteger(xpp));
1401    } else if (!parseDV_AMOUNTContent(eventType, xpp, res)){ //2
1402      return false;
1403    }
1404    return true;
1405  }
1406
1407  protected DV_QUANTITY parseDV_QUANTITY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1408    DV_QUANTITY res = new DV_QUANTITY();
1409    next(xpp);
1410    int eventType = nextNoWhitespace(xpp);
1411    while (eventType != XmlPullParser.END_TAG) {
1412    if (!parseDV_QUANTITYContent(eventType, xpp, res)) // 1
1413        unknownContent(xpp);
1414      eventType = nextNoWhitespace(xpp);
1415    }
1416    next(xpp);
1417    parseElementClose(res);
1418    return res;
1419  }
1420
1421  protected boolean parseDV_QUANTITYContent(int eventType, XmlPullParser xpp, DV_QUANTITY res) throws XmlPullParserException, IOException, FHIRFormatError {
1422    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("magnitude")) {
1423      res.setMagnitudeElement(parseDecimal(xpp));
1424    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precision")) {
1425      res.setPrecisionElement(parseInteger(xpp));
1426    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("units")) {
1427      res.setUnitsElement(parseString(xpp));
1428    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("units_system")) {
1429      res.setUnits_systemElement(parseString(xpp));
1430    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("units_display_name")) {
1431      res.setUnits_display_nameElement(parseString(xpp));
1432    } else if (!parseDV_AMOUNTContent(eventType, xpp, res)){ //2
1433      return false;
1434    }
1435    return true;
1436  }
1437
1438  protected DV_SCALE parseDV_SCALE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1439    DV_SCALE res = new DV_SCALE();
1440    next(xpp);
1441    int eventType = nextNoWhitespace(xpp);
1442    while (eventType != XmlPullParser.END_TAG) {
1443    if (!parseDV_SCALEContent(eventType, xpp, res)) // 1
1444        unknownContent(xpp);
1445      eventType = nextNoWhitespace(xpp);
1446    }
1447    next(xpp);
1448    parseElementClose(res);
1449    return res;
1450  }
1451
1452  protected boolean parseDV_SCALEContent(int eventType, XmlPullParser xpp, DV_SCALE res) throws XmlPullParserException, IOException, FHIRFormatError {
1453    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("symbol")) {
1454      res.setSymbol(parseDV_CODED_TEXT(xpp));
1455    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1456      res.setValueElement(parseDecimal(xpp));
1457    } else if (!parseDV_ORDEREDContent(eventType, xpp, res)){ //2
1458      return false;
1459    }
1460    return true;
1461  }
1462
1463  protected DV_STATE parseDV_STATE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1464    DV_STATE res = new DV_STATE();
1465    next(xpp);
1466    int eventType = nextNoWhitespace(xpp);
1467    while (eventType != XmlPullParser.END_TAG) {
1468    if (!parseDV_STATEContent(eventType, xpp, res)) // 1
1469        unknownContent(xpp);
1470      eventType = nextNoWhitespace(xpp);
1471    }
1472    next(xpp);
1473    parseElementClose(res);
1474    return res;
1475  }
1476
1477  protected boolean parseDV_STATEContent(int eventType, XmlPullParser xpp, DV_STATE res) throws XmlPullParserException, IOException, FHIRFormatError {
1478    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1479      res.setValue(parseDV_CODED_TEXT(xpp));
1480    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("is_terminal")) {
1481      res.setIs_terminalElement(parseBoolean(xpp));
1482    } else if (!parseDATA_VALUEContent(eventType, xpp, res)){ //2
1483      return false;
1484    }
1485    return true;
1486  }
1487
1488  protected DV_TEXT parseDV_TEXT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1489    DV_TEXT res = new DV_TEXT();
1490    next(xpp);
1491    int eventType = nextNoWhitespace(xpp);
1492    while (eventType != XmlPullParser.END_TAG) {
1493    if (!parseDV_TEXTContent(eventType, xpp, res)) // 1
1494        unknownContent(xpp);
1495      eventType = nextNoWhitespace(xpp);
1496    }
1497    next(xpp);
1498    parseElementClose(res);
1499    return res;
1500  }
1501
1502  protected boolean parseDV_TEXTContent(int eventType, XmlPullParser xpp, DV_TEXT res) throws XmlPullParserException, IOException, FHIRFormatError {
1503    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1504      res.setValueElement(parseString(xpp));
1505    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hyperlink")) {
1506      res.setHyperlink(parseDV_URI(xpp));
1507    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("formatting")) {
1508      res.setFormattingElement(parseString(xpp));
1509    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mappings")) {
1510      res.getMappingsList().add(parseTERM_MAPPING(xpp));
1511    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
1512      res.setLanguage(parseCODE_PHRASE(xpp));
1513    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encoding")) {
1514      res.setEncoding(parseCODE_PHRASE(xpp));
1515    } else if (!parseDATA_VALUEContent(eventType, xpp, res)){ //2
1516      return false;
1517    }
1518    return true;
1519  }
1520
1521  protected DV_TIME parseDV_TIME(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1522    DV_TIME res = new DV_TIME();
1523    next(xpp);
1524    int eventType = nextNoWhitespace(xpp);
1525    while (eventType != XmlPullParser.END_TAG) {
1526    if (!parseDV_TIMEContent(eventType, xpp, res)) // 1
1527        unknownContent(xpp);
1528      eventType = nextNoWhitespace(xpp);
1529    }
1530    next(xpp);
1531    parseElementClose(res);
1532    return res;
1533  }
1534
1535  protected boolean parseDV_TIMEContent(int eventType, XmlPullParser xpp, DV_TIME res) throws XmlPullParserException, IOException, FHIRFormatError {
1536    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1537      res.setValueElement(parseString(xpp));
1538    } else if (!parseDV_ORDEREDContent(eventType, xpp, res)){ //2
1539      return false;
1540    }
1541    return true;
1542  }
1543
1544  protected DV_URI parseDV_URI(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1545    DV_URI res = new DV_URI();
1546    next(xpp);
1547    int eventType = nextNoWhitespace(xpp);
1548    while (eventType != XmlPullParser.END_TAG) {
1549    if (!parseDV_URIContent(eventType, xpp, res)) // 1
1550        unknownContent(xpp);
1551      eventType = nextNoWhitespace(xpp);
1552    }
1553    next(xpp);
1554    parseElementClose(res);
1555    return res;
1556  }
1557
1558  protected boolean parseDV_URIContent(int eventType, XmlPullParser xpp, DV_URI res) throws XmlPullParserException, IOException, FHIRFormatError {
1559    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1560      res.setValueElement(parseUri(xpp));
1561    } else if (!parseDATA_VALUEContent(eventType, xpp, res)){ //2
1562      return false;
1563    }
1564    return true;
1565  }
1566
1567  protected EHR_ACCESS parseEHR_ACCESS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1568    EHR_ACCESS res = new EHR_ACCESS();
1569    next(xpp);
1570    int eventType = nextNoWhitespace(xpp);
1571    while (eventType != XmlPullParser.END_TAG) {
1572    if (!parseEHR_ACCESSContent(eventType, xpp, res)) // 1
1573        unknownContent(xpp);
1574      eventType = nextNoWhitespace(xpp);
1575    }
1576    next(xpp);
1577    parseElementClose(res);
1578    return res;
1579  }
1580
1581  protected boolean parseEHR_ACCESSContent(int eventType, XmlPullParser xpp, EHR_ACCESS res) throws XmlPullParserException, IOException, FHIRFormatError {
1582    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("settings")) {
1583      res.setSettings(parseACCESS_CONTROL_SETTINGS(xpp));
1584    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
1585      return false;
1586    }
1587    return true;
1588  }
1589
1590  protected EHR_STATUS parseEHR_STATUS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1591    EHR_STATUS res = new EHR_STATUS();
1592    next(xpp);
1593    int eventType = nextNoWhitespace(xpp);
1594    while (eventType != XmlPullParser.END_TAG) {
1595    if (!parseEHR_STATUSContent(eventType, xpp, res)) // 1
1596        unknownContent(xpp);
1597      eventType = nextNoWhitespace(xpp);
1598    }
1599    next(xpp);
1600    parseElementClose(res);
1601    return res;
1602  }
1603
1604  protected boolean parseEHR_STATUSContent(int eventType, XmlPullParser xpp, EHR_STATUS res) throws XmlPullParserException, IOException, FHIRFormatError {
1605    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
1606      res.setSubject(parsePARTY_SELF(xpp));
1607    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("is_queryable")) {
1608      res.setIs_queryableElement(parseBoolean(xpp));
1609    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("is_modifiable")) {
1610      res.setIs_modifiableElement(parseBoolean(xpp));
1611    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_details")) {
1612      res.setOther_details(parseITEM_STRUCTURE(xpp));
1613    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
1614      return false;
1615    }
1616    return true;
1617  }
1618
1619  protected EHR parseEHR(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1620    EHR res = new EHR();
1621    next(xpp);
1622    int eventType = nextNoWhitespace(xpp);
1623    while (eventType != XmlPullParser.END_TAG) {
1624    if (!parseEHRContent(eventType, xpp, res)) // 1
1625        unknownContent(xpp);
1626      eventType = nextNoWhitespace(xpp);
1627    }
1628    next(xpp);
1629    parseElementClose(res);
1630    return res;
1631  }
1632
1633  protected boolean parseEHRContent(int eventType, XmlPullParser xpp, EHR res) throws XmlPullParserException, IOException, FHIRFormatError {
1634    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system_id")) {
1635      res.getSystem_idList().add(parseHIER_OBJECT_ID(xpp));
1636    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ehr_id")) {
1637      res.setEhr_id(parseHIER_OBJECT_ID(xpp));
1638    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("contributions")) {
1639      res.getContributionsList().add(parseOBJECT_REF(xpp));
1640    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ehr_status")) {
1641      res.setEhr_status(parseOBJECT_REF(xpp));
1642    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ehr_access")) {
1643      res.setEhr_access(parseOBJECT_REF(xpp));
1644    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("compositions")) {
1645      res.getCompositionsList().add(parseOBJECT_REF(xpp));
1646    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("directory")) {
1647      res.setDirectory(parseOBJECT_REF(xpp));
1648    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time_created")) {
1649      res.setTime_created(parseDV_DATE_TIME(xpp));
1650    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("folders")) {
1651      res.getFoldersList().add(parseOBJECT_REF(xpp));
1652    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tags")) {
1653      res.getTagsList().add(parseOBJECT_REF(xpp));
1654    } else if (!parseAnyContent(eventType, xpp, res)){ //2
1655      return false;
1656    }
1657    return true;
1658  }
1659
1660  protected ELEMENT parseELEMENT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1661    ELEMENT res = new ELEMENT();
1662    next(xpp);
1663    int eventType = nextNoWhitespace(xpp);
1664    while (eventType != XmlPullParser.END_TAG) {
1665    if (!parseELEMENTContent(eventType, xpp, res)) // 1
1666        unknownContent(xpp);
1667      eventType = nextNoWhitespace(xpp);
1668    }
1669    next(xpp);
1670    parseElementClose(res);
1671    return res;
1672  }
1673
1674  protected boolean parseELEMENTContent(int eventType, XmlPullParser xpp, ELEMENT res) throws XmlPullParserException, IOException, FHIRFormatError {
1675    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("null_flavour")) {
1676      res.setNull_flavour(parseDV_CODED_TEXT(xpp));
1677    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
1678      res.setValue(parseDATA_VALUE(xpp));
1679    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("null_reason")) {
1680      res.setNull_reason(parseDV_TEXT(xpp));
1681    } else if (!parseITEMContent(eventType, xpp, res)){ //2
1682      return false;
1683    }
1684    return true;
1685  }
1686
1687  protected EVALUATION parseEVALUATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1688    EVALUATION res = new EVALUATION();
1689    next(xpp);
1690    int eventType = nextNoWhitespace(xpp);
1691    while (eventType != XmlPullParser.END_TAG) {
1692    if (!parseEVALUATIONContent(eventType, xpp, res)) // 1
1693        unknownContent(xpp);
1694      eventType = nextNoWhitespace(xpp);
1695    }
1696    next(xpp);
1697    parseElementClose(res);
1698    return res;
1699  }
1700
1701  protected boolean parseEVALUATIONContent(int eventType, XmlPullParser xpp, EVALUATION res) throws XmlPullParserException, IOException, FHIRFormatError {
1702    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
1703      res.setData(parseITEM_STRUCTURE(xpp));
1704    } else if (!parseCARE_ENTRYContent(eventType, xpp, res)){ //2
1705      return false;
1706    }
1707    return true;
1708  }
1709
1710  protected EVENT_CONTEXT parseEVENT_CONTEXT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1711    EVENT_CONTEXT res = new EVENT_CONTEXT();
1712    next(xpp);
1713    int eventType = nextNoWhitespace(xpp);
1714    while (eventType != XmlPullParser.END_TAG) {
1715    if (!parseEVENT_CONTEXTContent(eventType, xpp, res)) // 1
1716        unknownContent(xpp);
1717      eventType = nextNoWhitespace(xpp);
1718    }
1719    next(xpp);
1720    parseElementClose(res);
1721    return res;
1722  }
1723
1724  protected boolean parseEVENT_CONTEXTContent(int eventType, XmlPullParser xpp, EVENT_CONTEXT res) throws XmlPullParserException, IOException, FHIRFormatError {
1725    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("start_time")) {
1726      res.setStart_time(parseDV_DATE_TIME(xpp));
1727    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("end_time")) {
1728      res.setEnd_time(parseDV_DATE_TIME(xpp));
1729    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
1730      res.setLocationElement(parseString(xpp));
1731    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("setting")) {
1732      res.setSetting(parseDV_CODED_TEXT(xpp));
1733    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_context")) {
1734      res.setOther_context(parseITEM_STRUCTURE(xpp));
1735    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("health_care_facility")) {
1736      res.setHealth_care_facility(parsePARTY_IDENTIFIED(xpp));
1737    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("participations")) {
1738      res.getParticipationsList().add(parsePARTICIPATION(xpp));
1739    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
1740      return false;
1741    }
1742    return true;
1743  }
1744
1745  protected FEEDER_AUDIT_DETAILS parseFEEDER_AUDIT_DETAILS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1746    FEEDER_AUDIT_DETAILS res = new FEEDER_AUDIT_DETAILS();
1747    next(xpp);
1748    int eventType = nextNoWhitespace(xpp);
1749    while (eventType != XmlPullParser.END_TAG) {
1750    if (!parseFEEDER_AUDIT_DETAILSContent(eventType, xpp, res)) // 1
1751        unknownContent(xpp);
1752      eventType = nextNoWhitespace(xpp);
1753    }
1754    next(xpp);
1755    parseElementClose(res);
1756    return res;
1757  }
1758
1759  protected boolean parseFEEDER_AUDIT_DETAILSContent(int eventType, XmlPullParser xpp, FEEDER_AUDIT_DETAILS res) throws XmlPullParserException, IOException, FHIRFormatError {
1760    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("system_id")) {
1761      res.setSystem_idElement(parseString(xpp));
1762    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("location")) {
1763      res.setLocation(parsePARTY_IDENTIFIED(xpp));
1764    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) {
1765      res.setSubject(parsePARTY_PROXY(xpp));
1766    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("provider")) {
1767      res.setProvider(parsePARTY_IDENTIFIED(xpp));
1768    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
1769      res.setTime(parseDV_DATE_TIME(xpp));
1770    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version_id")) {
1771      res.setVersion_idElement(parseString(xpp));
1772    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_details")) {
1773      res.setOther_details(parseITEM_STRUCTURE(xpp));
1774    } else if (!parseBaseContent(eventType, xpp, res)){ //2
1775      return false;
1776    }
1777    return true;
1778  }
1779
1780  protected FEEDER_AUDIT parseFEEDER_AUDIT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1781    FEEDER_AUDIT res = new FEEDER_AUDIT();
1782    next(xpp);
1783    int eventType = nextNoWhitespace(xpp);
1784    while (eventType != XmlPullParser.END_TAG) {
1785    if (!parseFEEDER_AUDITContent(eventType, xpp, res)) // 1
1786        unknownContent(xpp);
1787      eventType = nextNoWhitespace(xpp);
1788    }
1789    next(xpp);
1790    parseElementClose(res);
1791    return res;
1792  }
1793
1794  protected boolean parseFEEDER_AUDITContent(int eventType, XmlPullParser xpp, FEEDER_AUDIT res) throws XmlPullParserException, IOException, FHIRFormatError {
1795    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("originating_system_item_ids")) {
1796      res.getOriginating_system_item_idsList().add(parseDV_IDENTIFIER(xpp));
1797    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("feeder_system_item_ids")) {
1798      res.getFeeder_system_item_idsList().add(parseDV_IDENTIFIER(xpp));
1799    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("original_content")) {
1800      res.setOriginal_content(parseDV_ENCAPSULATED(xpp));
1801    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("originating_system_audit")) {
1802      res.setOriginating_system_audit(parseFEEDER_AUDIT_DETAILS(xpp));
1803    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("feeder_system_audit")) {
1804      res.setFeeder_system_audit(parseFEEDER_AUDIT_DETAILS(xpp));
1805    } else if (!parseBaseContent(eventType, xpp, res)){ //2
1806      return false;
1807    }
1808    return true;
1809  }
1810
1811  protected FOLDER parseFOLDER(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1812    FOLDER res = new FOLDER();
1813    next(xpp);
1814    int eventType = nextNoWhitespace(xpp);
1815    while (eventType != XmlPullParser.END_TAG) {
1816    if (!parseFOLDERContent(eventType, xpp, res)) // 1
1817        unknownContent(xpp);
1818      eventType = nextNoWhitespace(xpp);
1819    }
1820    next(xpp);
1821    parseElementClose(res);
1822    return res;
1823  }
1824
1825  protected boolean parseFOLDERContent(int eventType, XmlPullParser xpp, FOLDER res) throws XmlPullParserException, IOException, FHIRFormatError {
1826    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("items")) {
1827      res.getItemsList().add(parseOBJECT_REF(xpp));
1828    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("folders")) {
1829      res.getFoldersList().add(parseFOLDER(xpp));
1830    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
1831      res.setDetails(parseITEM_STRUCTURE(xpp));
1832    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
1833      return false;
1834    }
1835    return true;
1836  }
1837
1838  protected GENERIC_ID parseGENERIC_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1839    GENERIC_ID res = new GENERIC_ID();
1840    next(xpp);
1841    int eventType = nextNoWhitespace(xpp);
1842    while (eventType != XmlPullParser.END_TAG) {
1843    if (!parseGENERIC_IDContent(eventType, xpp, res)) // 1
1844        unknownContent(xpp);
1845      eventType = nextNoWhitespace(xpp);
1846    }
1847    next(xpp);
1848    parseElementClose(res);
1849    return res;
1850  }
1851
1852  protected boolean parseGENERIC_IDContent(int eventType, XmlPullParser xpp, GENERIC_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
1853    if (!parseOBJECT_IDContent(eventType, xpp, res)){ //2
1854      return false;
1855    }
1856    return true;
1857  }
1858
1859  protected GROUP parseGROUP(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1860    GROUP res = new GROUP();
1861    next(xpp);
1862    int eventType = nextNoWhitespace(xpp);
1863    while (eventType != XmlPullParser.END_TAG) {
1864    if (!parseGROUPContent(eventType, xpp, res)) // 1
1865        unknownContent(xpp);
1866      eventType = nextNoWhitespace(xpp);
1867    }
1868    next(xpp);
1869    parseElementClose(res);
1870    return res;
1871  }
1872
1873  protected boolean parseGROUPContent(int eventType, XmlPullParser xpp, GROUP res) throws XmlPullParserException, IOException, FHIRFormatError {
1874    if (!parseACTORContent(eventType, xpp, res)){ //2
1875      return false;
1876    }
1877    return true;
1878  }
1879
1880  protected HIER_OBJECT_ID parseHIER_OBJECT_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1881    HIER_OBJECT_ID res = new HIER_OBJECT_ID();
1882    next(xpp);
1883    int eventType = nextNoWhitespace(xpp);
1884    while (eventType != XmlPullParser.END_TAG) {
1885    if (!parseHIER_OBJECT_IDContent(eventType, xpp, res)) // 1
1886        unknownContent(xpp);
1887      eventType = nextNoWhitespace(xpp);
1888    }
1889    next(xpp);
1890    parseElementClose(res);
1891    return res;
1892  }
1893
1894  protected boolean parseHIER_OBJECT_IDContent(int eventType, XmlPullParser xpp, HIER_OBJECT_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
1895    if (!parseUID_BASED_IDContent(eventType, xpp, res)){ //2
1896      return false;
1897    }
1898    return true;
1899  }
1900
1901  protected HISTORY parseHISTORY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1902    HISTORY res = new HISTORY();
1903    next(xpp);
1904    int eventType = nextNoWhitespace(xpp);
1905    while (eventType != XmlPullParser.END_TAG) {
1906    if (!parseHISTORYContent(eventType, xpp, res)) // 1
1907        unknownContent(xpp);
1908      eventType = nextNoWhitespace(xpp);
1909    }
1910    next(xpp);
1911    parseElementClose(res);
1912    return res;
1913  }
1914
1915  protected boolean parseHISTORYContent(int eventType, XmlPullParser xpp, HISTORY res) throws XmlPullParserException, IOException, FHIRFormatError {
1916    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("origin")) {
1917      res.setOrigin(parseDV_DATE_TIME(xpp));
1918    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("period")) {
1919      res.setPeriod(parseDV_DURATION(xpp));
1920    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("duration")) {
1921      res.setDuration(parseDV_DURATION(xpp));
1922    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
1923      res.setSummary(parseITEM_STRUCTURE(xpp));
1924    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("events")) {
1925      res.getEventsList().add(parseEVENT(xpp));
1926    } else if (!parseDATA_STRUCTUREContent(eventType, xpp, res)){ //2
1927      return false;
1928    }
1929    return true;
1930  }
1931
1932  protected IMPORTED_VERSION parseIMPORTED_VERSION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1933    IMPORTED_VERSION res = new IMPORTED_VERSION();
1934    next(xpp);
1935    int eventType = nextNoWhitespace(xpp);
1936    while (eventType != XmlPullParser.END_TAG) {
1937    if (!parseIMPORTED_VERSIONContent(eventType, xpp, res)) // 1
1938        unknownContent(xpp);
1939      eventType = nextNoWhitespace(xpp);
1940    }
1941    next(xpp);
1942    parseElementClose(res);
1943    return res;
1944  }
1945
1946  protected boolean parseIMPORTED_VERSIONContent(int eventType, XmlPullParser xpp, IMPORTED_VERSION res) throws XmlPullParserException, IOException, FHIRFormatError {
1947    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
1948      res.setItem(parseORIGINAL_VERSION(xpp));
1949    } else if (!parseVERSIONContent(eventType, xpp, res)){ //2
1950      return false;
1951    }
1952    return true;
1953  }
1954
1955  protected INSTRUCTION_DETAILS parseINSTRUCTION_DETAILS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1956    INSTRUCTION_DETAILS res = new INSTRUCTION_DETAILS();
1957    next(xpp);
1958    int eventType = nextNoWhitespace(xpp);
1959    while (eventType != XmlPullParser.END_TAG) {
1960    if (!parseINSTRUCTION_DETAILSContent(eventType, xpp, res)) // 1
1961        unknownContent(xpp);
1962      eventType = nextNoWhitespace(xpp);
1963    }
1964    next(xpp);
1965    parseElementClose(res);
1966    return res;
1967  }
1968
1969  protected boolean parseINSTRUCTION_DETAILSContent(int eventType, XmlPullParser xpp, INSTRUCTION_DETAILS res) throws XmlPullParserException, IOException, FHIRFormatError {
1970    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("instruction_id")) {
1971      res.setInstruction_id(parseLOCATABLE_REF(xpp));
1972    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activity_id")) {
1973      res.setActivity_idElement(parseString(xpp));
1974    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("wf_details")) {
1975      res.setWf_details(parseITEM_STRUCTURE(xpp));
1976    } else if (!parsePATHABLEContent(eventType, xpp, res)){ //2
1977      return false;
1978    }
1979    return true;
1980  }
1981
1982  protected INSTRUCTION parseINSTRUCTION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
1983    INSTRUCTION res = new INSTRUCTION();
1984    next(xpp);
1985    int eventType = nextNoWhitespace(xpp);
1986    while (eventType != XmlPullParser.END_TAG) {
1987    if (!parseINSTRUCTIONContent(eventType, xpp, res)) // 1
1988        unknownContent(xpp);
1989      eventType = nextNoWhitespace(xpp);
1990    }
1991    next(xpp);
1992    parseElementClose(res);
1993    return res;
1994  }
1995
1996  protected boolean parseINSTRUCTIONContent(int eventType, XmlPullParser xpp, INSTRUCTION res) throws XmlPullParserException, IOException, FHIRFormatError {
1997    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("narrative")) {
1998      res.setNarrative(parseDV_TEXT(xpp));
1999    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expiry_time")) {
2000      res.setExpiry_time(parseDV_DATE_TIME(xpp));
2001    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("wf_definition")) {
2002      res.setWf_definition(parseDV_PARSABLE(xpp));
2003    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("activities")) {
2004      res.getActivitiesList().add(parseACTIVITY(xpp));
2005    } else if (!parseCARE_ENTRYContent(eventType, xpp, res)){ //2
2006      return false;
2007    }
2008    return true;
2009  }
2010
2011  protected INTERNET_ID parseINTERNET_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2012    INTERNET_ID res = new INTERNET_ID();
2013    next(xpp);
2014    int eventType = nextNoWhitespace(xpp);
2015    while (eventType != XmlPullParser.END_TAG) {
2016    if (!parseINTERNET_IDContent(eventType, xpp, res)) // 1
2017        unknownContent(xpp);
2018      eventType = nextNoWhitespace(xpp);
2019    }
2020    next(xpp);
2021    parseElementClose(res);
2022    return res;
2023  }
2024
2025  protected boolean parseINTERNET_IDContent(int eventType, XmlPullParser xpp, INTERNET_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
2026    if (!parseUIDContent(eventType, xpp, res)){ //2
2027      return false;
2028    }
2029    return true;
2030  }
2031
2032  protected INTERVAL_EVENT parseINTERVAL_EVENT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2033    INTERVAL_EVENT res = new INTERVAL_EVENT();
2034    next(xpp);
2035    int eventType = nextNoWhitespace(xpp);
2036    while (eventType != XmlPullParser.END_TAG) {
2037    if (!parseINTERVAL_EVENTContent(eventType, xpp, res)) // 1
2038        unknownContent(xpp);
2039      eventType = nextNoWhitespace(xpp);
2040    }
2041    next(xpp);
2042    parseElementClose(res);
2043    return res;
2044  }
2045
2046  protected boolean parseINTERVAL_EVENTContent(int eventType, XmlPullParser xpp, INTERVAL_EVENT res) throws XmlPullParserException, IOException, FHIRFormatError {
2047    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("width")) {
2048      res.setWidth(parseDV_DURATION(xpp));
2049    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("sample_count")) {
2050      res.setSample_countElement(parseInteger(xpp));
2051    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("math_function")) {
2052      res.setMath_function(parseDV_CODED_TEXT(xpp));
2053    } else if (!parseEVENTContent(eventType, xpp, res)){ //2
2054      return false;
2055    }
2056    return true;
2057  }
2058
2059  protected ISM_TRANSITION parseISM_TRANSITION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2060    ISM_TRANSITION res = new ISM_TRANSITION();
2061    next(xpp);
2062    int eventType = nextNoWhitespace(xpp);
2063    while (eventType != XmlPullParser.END_TAG) {
2064    if (!parseISM_TRANSITIONContent(eventType, xpp, res)) // 1
2065        unknownContent(xpp);
2066      eventType = nextNoWhitespace(xpp);
2067    }
2068    next(xpp);
2069    parseElementClose(res);
2070    return res;
2071  }
2072
2073  protected boolean parseISM_TRANSITIONContent(int eventType, XmlPullParser xpp, ISM_TRANSITION res) throws XmlPullParserException, IOException, FHIRFormatError {
2074    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("current_state")) {
2075      res.setCurrent_state(parseDV_CODED_TEXT(xpp));
2076    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("transition")) {
2077      res.setTransition(parseDV_CODED_TEXT(xpp));
2078    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("careflow_step")) {
2079      res.setCareflow_step(parseDV_CODED_TEXT(xpp));
2080    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("reason")) {
2081      res.getReasonList().add(parseDV_TEXT(xpp));
2082    } else if (!parsePATHABLEContent(eventType, xpp, res)){ //2
2083      return false;
2084    }
2085    return true;
2086  }
2087
2088  protected ISO_OID parseISO_OID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2089    ISO_OID res = new ISO_OID();
2090    next(xpp);
2091    int eventType = nextNoWhitespace(xpp);
2092    while (eventType != XmlPullParser.END_TAG) {
2093    if (!parseISO_OIDContent(eventType, xpp, res)) // 1
2094        unknownContent(xpp);
2095      eventType = nextNoWhitespace(xpp);
2096    }
2097    next(xpp);
2098    parseElementClose(res);
2099    return res;
2100  }
2101
2102  protected boolean parseISO_OIDContent(int eventType, XmlPullParser xpp, ISO_OID res) throws XmlPullParserException, IOException, FHIRFormatError {
2103    if (!parseUIDContent(eventType, xpp, res)){ //2
2104      return false;
2105    }
2106    return true;
2107  }
2108
2109  protected ITEM_LIST parseITEM_LIST(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2110    ITEM_LIST res = new ITEM_LIST();
2111    next(xpp);
2112    int eventType = nextNoWhitespace(xpp);
2113    while (eventType != XmlPullParser.END_TAG) {
2114    if (!parseITEM_LISTContent(eventType, xpp, res)) // 1
2115        unknownContent(xpp);
2116      eventType = nextNoWhitespace(xpp);
2117    }
2118    next(xpp);
2119    parseElementClose(res);
2120    return res;
2121  }
2122
2123  protected boolean parseITEM_LISTContent(int eventType, XmlPullParser xpp, ITEM_LIST res) throws XmlPullParserException, IOException, FHIRFormatError {
2124    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("items")) {
2125      res.getItemsList().add(parseELEMENT(xpp));
2126    } else if (!parseITEM_STRUCTUREContent(eventType, xpp, res)){ //2
2127      return false;
2128    }
2129    return true;
2130  }
2131
2132  protected ITEM_SINGLE parseITEM_SINGLE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2133    ITEM_SINGLE res = new ITEM_SINGLE();
2134    next(xpp);
2135    int eventType = nextNoWhitespace(xpp);
2136    while (eventType != XmlPullParser.END_TAG) {
2137    if (!parseITEM_SINGLEContent(eventType, xpp, res)) // 1
2138        unknownContent(xpp);
2139      eventType = nextNoWhitespace(xpp);
2140    }
2141    next(xpp);
2142    parseElementClose(res);
2143    return res;
2144  }
2145
2146  protected boolean parseITEM_SINGLEContent(int eventType, XmlPullParser xpp, ITEM_SINGLE res) throws XmlPullParserException, IOException, FHIRFormatError {
2147    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("item")) {
2148      res.setItem(parseELEMENT(xpp));
2149    } else if (!parseITEM_STRUCTUREContent(eventType, xpp, res)){ //2
2150      return false;
2151    }
2152    return true;
2153  }
2154
2155  protected ITEM_TABLE parseITEM_TABLE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2156    ITEM_TABLE res = new ITEM_TABLE();
2157    next(xpp);
2158    int eventType = nextNoWhitespace(xpp);
2159    while (eventType != XmlPullParser.END_TAG) {
2160    if (!parseITEM_TABLEContent(eventType, xpp, res)) // 1
2161        unknownContent(xpp);
2162      eventType = nextNoWhitespace(xpp);
2163    }
2164    next(xpp);
2165    parseElementClose(res);
2166    return res;
2167  }
2168
2169  protected boolean parseITEM_TABLEContent(int eventType, XmlPullParser xpp, ITEM_TABLE res) throws XmlPullParserException, IOException, FHIRFormatError {
2170    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rows")) {
2171      res.getRowsList().add(parseCLUSTER(xpp));
2172    } else if (!parseITEM_STRUCTUREContent(eventType, xpp, res)){ //2
2173      return false;
2174    }
2175    return true;
2176  }
2177
2178  protected ITEM_TAG parseITEM_TAG(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2179    ITEM_TAG res = new ITEM_TAG();
2180    next(xpp);
2181    int eventType = nextNoWhitespace(xpp);
2182    while (eventType != XmlPullParser.END_TAG) {
2183    if (!parseITEM_TAGContent(eventType, xpp, res)) // 1
2184        unknownContent(xpp);
2185      eventType = nextNoWhitespace(xpp);
2186    }
2187    next(xpp);
2188    parseElementClose(res);
2189    return res;
2190  }
2191
2192  protected boolean parseITEM_TAGContent(int eventType, XmlPullParser xpp, ITEM_TAG res) throws XmlPullParserException, IOException, FHIRFormatError {
2193    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("key")) {
2194      res.setKeyElement(parseString(xpp));
2195    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
2196      res.setValueElement(parseString(xpp));
2197    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
2198      res.setTarget(parseUID_BASED_ID(xpp));
2199    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target_path")) {
2200      res.setTarget_pathElement(parseString(xpp));
2201    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("owner_id")) {
2202      res.setOwner_id(parseOBJECT_REF(xpp));
2203    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2204      return false;
2205    }
2206    return true;
2207  }
2208
2209  protected ITEM_TREE parseITEM_TREE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2210    ITEM_TREE res = new ITEM_TREE();
2211    next(xpp);
2212    int eventType = nextNoWhitespace(xpp);
2213    while (eventType != XmlPullParser.END_TAG) {
2214    if (!parseITEM_TREEContent(eventType, xpp, res)) // 1
2215        unknownContent(xpp);
2216      eventType = nextNoWhitespace(xpp);
2217    }
2218    next(xpp);
2219    parseElementClose(res);
2220    return res;
2221  }
2222
2223  protected boolean parseITEM_TREEContent(int eventType, XmlPullParser xpp, ITEM_TREE res) throws XmlPullParserException, IOException, FHIRFormatError {
2224    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("items")) {
2225      res.getItemsList().add(parseITEM(xpp));
2226    } else if (!parseITEM_STRUCTUREContent(eventType, xpp, res)){ //2
2227      return false;
2228    }
2229    return true;
2230  }
2231
2232  protected LINK parseLINK(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2233    LINK res = new LINK();
2234    next(xpp);
2235    int eventType = nextNoWhitespace(xpp);
2236    while (eventType != XmlPullParser.END_TAG) {
2237    if (!parseLINKContent(eventType, xpp, res)) // 1
2238        unknownContent(xpp);
2239      eventType = nextNoWhitespace(xpp);
2240    }
2241    next(xpp);
2242    parseElementClose(res);
2243    return res;
2244  }
2245
2246  protected boolean parseLINKContent(int eventType, XmlPullParser xpp, LINK res) throws XmlPullParserException, IOException, FHIRFormatError {
2247    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meaning")) {
2248      res.setMeaning(parseDV_TEXT(xpp));
2249    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2250      res.setType(parseDV_TEXT(xpp));
2251    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
2252      res.setTarget(parseDV_EHR_URI(xpp));
2253    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2254      return false;
2255    }
2256    return true;
2257  }
2258
2259  protected LOCATABLE_REF parseLOCATABLE_REF(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2260    LOCATABLE_REF res = new LOCATABLE_REF();
2261    next(xpp);
2262    int eventType = nextNoWhitespace(xpp);
2263    while (eventType != XmlPullParser.END_TAG) {
2264    if (!parseLOCATABLE_REFContent(eventType, xpp, res)) // 1
2265        unknownContent(xpp);
2266      eventType = nextNoWhitespace(xpp);
2267    }
2268    next(xpp);
2269    parseElementClose(res);
2270    return res;
2271  }
2272
2273  protected boolean parseLOCATABLE_REFContent(int eventType, XmlPullParser xpp, LOCATABLE_REF res) throws XmlPullParserException, IOException, FHIRFormatError {
2274    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("path")) {
2275      res.setPathElement(parseString(xpp));
2276    } else if (!parseOBJECT_REFContent(eventType, xpp, res)){ //2
2277      return false;
2278    }
2279    return true;
2280  }
2281
2282  protected OBJECT_REF parseOBJECT_REF(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2283    OBJECT_REF res = new OBJECT_REF();
2284    next(xpp);
2285    int eventType = nextNoWhitespace(xpp);
2286    while (eventType != XmlPullParser.END_TAG) {
2287    if (!parseOBJECT_REFContent(eventType, xpp, res)) // 1
2288        unknownContent(xpp);
2289      eventType = nextNoWhitespace(xpp);
2290    }
2291    next(xpp);
2292    parseElementClose(res);
2293    return res;
2294  }
2295
2296  protected boolean parseOBJECT_REFContent(int eventType, XmlPullParser xpp, OBJECT_REF res) throws XmlPullParserException, IOException, FHIRFormatError {
2297    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("namespace")) {
2298      res.setNamespaceElement(parseString(xpp));
2299    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
2300      res.setTypeElement(parseString(xpp));
2301    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("id")) {
2302      res.setId(parseOBJECT_ID(xpp));
2303    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2304      return false;
2305    }
2306    return true;
2307  }
2308
2309  protected OBJECT_VERSION_ID parseOBJECT_VERSION_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2310    OBJECT_VERSION_ID res = new OBJECT_VERSION_ID();
2311    next(xpp);
2312    int eventType = nextNoWhitespace(xpp);
2313    while (eventType != XmlPullParser.END_TAG) {
2314    if (!parseOBJECT_VERSION_IDContent(eventType, xpp, res)) // 1
2315        unknownContent(xpp);
2316      eventType = nextNoWhitespace(xpp);
2317    }
2318    next(xpp);
2319    parseElementClose(res);
2320    return res;
2321  }
2322
2323  protected boolean parseOBJECT_VERSION_IDContent(int eventType, XmlPullParser xpp, OBJECT_VERSION_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
2324    if (!parseUID_BASED_IDContent(eventType, xpp, res)){ //2
2325      return false;
2326    }
2327    return true;
2328  }
2329
2330  protected OBSERVATION parseOBSERVATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2331    OBSERVATION res = new OBSERVATION();
2332    next(xpp);
2333    int eventType = nextNoWhitespace(xpp);
2334    while (eventType != XmlPullParser.END_TAG) {
2335    if (!parseOBSERVATIONContent(eventType, xpp, res)) // 1
2336        unknownContent(xpp);
2337      eventType = nextNoWhitespace(xpp);
2338    }
2339    next(xpp);
2340    parseElementClose(res);
2341    return res;
2342  }
2343
2344  protected boolean parseOBSERVATIONContent(int eventType, XmlPullParser xpp, OBSERVATION res) throws XmlPullParserException, IOException, FHIRFormatError {
2345    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
2346      res.setData(parseHISTORY(xpp));
2347    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("state")) {
2348      res.setState(parseHISTORY(xpp));
2349    } else if (!parseCARE_ENTRYContent(eventType, xpp, res)){ //2
2350      return false;
2351    }
2352    return true;
2353  }
2354
2355  protected ORGANISATION parseORGANISATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2356    ORGANISATION res = new ORGANISATION();
2357    next(xpp);
2358    int eventType = nextNoWhitespace(xpp);
2359    while (eventType != XmlPullParser.END_TAG) {
2360    if (!parseORGANISATIONContent(eventType, xpp, res)) // 1
2361        unknownContent(xpp);
2362      eventType = nextNoWhitespace(xpp);
2363    }
2364    next(xpp);
2365    parseElementClose(res);
2366    return res;
2367  }
2368
2369  protected boolean parseORGANISATIONContent(int eventType, XmlPullParser xpp, ORGANISATION res) throws XmlPullParserException, IOException, FHIRFormatError {
2370    if (!parseACTORContent(eventType, xpp, res)){ //2
2371      return false;
2372    }
2373    return true;
2374  }
2375
2376  protected ORIGINAL_VERSION parseORIGINAL_VERSION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2377    ORIGINAL_VERSION res = new ORIGINAL_VERSION();
2378    next(xpp);
2379    int eventType = nextNoWhitespace(xpp);
2380    while (eventType != XmlPullParser.END_TAG) {
2381    if (!parseORIGINAL_VERSIONContent(eventType, xpp, res)) // 1
2382        unknownContent(xpp);
2383      eventType = nextNoWhitespace(xpp);
2384    }
2385    next(xpp);
2386    parseElementClose(res);
2387    return res;
2388  }
2389
2390  protected boolean parseORIGINAL_VERSIONContent(int eventType, XmlPullParser xpp, ORIGINAL_VERSION res) throws XmlPullParserException, IOException, FHIRFormatError {
2391    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
2392      res.setUid(parseOBJECT_VERSION_ID(xpp));
2393    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("preceding_version_uid")) {
2394      res.setPreceding_version_uid(parseOBJECT_VERSION_ID(xpp));
2395    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_input_version_uids")) {
2396      res.getOther_input_version_uidsList().add(parseOBJECT_VERSION_ID(xpp));
2397    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lifecycle_state")) {
2398      res.setLifecycle_state(parseDV_CODED_TEXT(xpp));
2399    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("attestations")) {
2400      res.getAttestationsList().add(parseATTESTATION(xpp));
2401    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("data")) {
2402      res.setData(parseAny(xpp));
2403    } else if (!parseVERSIONContent(eventType, xpp, res)){ //2
2404      return false;
2405    }
2406    return true;
2407  }
2408
2409  protected PARTICIPATION parsePARTICIPATION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2410    PARTICIPATION res = new PARTICIPATION();
2411    next(xpp);
2412    int eventType = nextNoWhitespace(xpp);
2413    while (eventType != XmlPullParser.END_TAG) {
2414    if (!parsePARTICIPATIONContent(eventType, xpp, res)) // 1
2415        unknownContent(xpp);
2416      eventType = nextNoWhitespace(xpp);
2417    }
2418    next(xpp);
2419    parseElementClose(res);
2420    return res;
2421  }
2422
2423  protected boolean parsePARTICIPATIONContent(int eventType, XmlPullParser xpp, PARTICIPATION res) throws XmlPullParserException, IOException, FHIRFormatError {
2424    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("function")) {
2425      res.setFunction(parseDV_TEXT(xpp));
2426    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) {
2427      res.setMode(parseDV_CODED_TEXT(xpp));
2428    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
2429      res.setPerformer(parsePARTY_PROXY(xpp));
2430    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time")) {
2431      res.setTime(parseDV_INTERVAL(xpp));
2432    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
2433      return false;
2434    }
2435    return true;
2436  }
2437
2438  protected PARTY_IDENTIFIED parsePARTY_IDENTIFIED(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2439    PARTY_IDENTIFIED res = new PARTY_IDENTIFIED();
2440    next(xpp);
2441    int eventType = nextNoWhitespace(xpp);
2442    while (eventType != XmlPullParser.END_TAG) {
2443    if (!parsePARTY_IDENTIFIEDContent(eventType, xpp, res)) // 1
2444        unknownContent(xpp);
2445      eventType = nextNoWhitespace(xpp);
2446    }
2447    next(xpp);
2448    parseElementClose(res);
2449    return res;
2450  }
2451
2452  protected boolean parsePARTY_IDENTIFIEDContent(int eventType, XmlPullParser xpp, PARTY_IDENTIFIED res) throws XmlPullParserException, IOException, FHIRFormatError {
2453    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
2454      res.setNameElement(parseString(xpp));
2455    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("identifiers")) {
2456      res.getIdentifiersList().add(parseDV_IDENTIFIER(xpp));
2457    } else if (!parsePARTY_PROXYContent(eventType, xpp, res)){ //2
2458      return false;
2459    }
2460    return true;
2461  }
2462
2463  protected PARTY_IDENTITY parsePARTY_IDENTITY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2464    PARTY_IDENTITY res = new PARTY_IDENTITY();
2465    next(xpp);
2466    int eventType = nextNoWhitespace(xpp);
2467    while (eventType != XmlPullParser.END_TAG) {
2468    if (!parsePARTY_IDENTITYContent(eventType, xpp, res)) // 1
2469        unknownContent(xpp);
2470      eventType = nextNoWhitespace(xpp);
2471    }
2472    next(xpp);
2473    parseElementClose(res);
2474    return res;
2475  }
2476
2477  protected boolean parsePARTY_IDENTITYContent(int eventType, XmlPullParser xpp, PARTY_IDENTITY res) throws XmlPullParserException, IOException, FHIRFormatError {
2478    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
2479      res.setDetails(parseITEM_STRUCTURE(xpp));
2480    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
2481      return false;
2482    }
2483    return true;
2484  }
2485
2486  protected PARTY_REF parsePARTY_REF(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2487    PARTY_REF res = new PARTY_REF();
2488    next(xpp);
2489    int eventType = nextNoWhitespace(xpp);
2490    while (eventType != XmlPullParser.END_TAG) {
2491    if (!parsePARTY_REFContent(eventType, xpp, res)) // 1
2492        unknownContent(xpp);
2493      eventType = nextNoWhitespace(xpp);
2494    }
2495    next(xpp);
2496    parseElementClose(res);
2497    return res;
2498  }
2499
2500  protected boolean parsePARTY_REFContent(int eventType, XmlPullParser xpp, PARTY_REF res) throws XmlPullParserException, IOException, FHIRFormatError {
2501    if (!parseOBJECT_REFContent(eventType, xpp, res)){ //2
2502      return false;
2503    }
2504    return true;
2505  }
2506
2507  protected PARTY_RELATED parsePARTY_RELATED(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2508    PARTY_RELATED res = new PARTY_RELATED();
2509    next(xpp);
2510    int eventType = nextNoWhitespace(xpp);
2511    while (eventType != XmlPullParser.END_TAG) {
2512    if (!parsePARTY_RELATEDContent(eventType, xpp, res)) // 1
2513        unknownContent(xpp);
2514      eventType = nextNoWhitespace(xpp);
2515    }
2516    next(xpp);
2517    parseElementClose(res);
2518    return res;
2519  }
2520
2521  protected boolean parsePARTY_RELATEDContent(int eventType, XmlPullParser xpp, PARTY_RELATED res) throws XmlPullParserException, IOException, FHIRFormatError {
2522    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("relationship")) {
2523      res.setRelationship(parseDV_CODED_TEXT(xpp));
2524    } else if (!parsePARTY_IDENTIFIEDContent(eventType, xpp, res)){ //2
2525      return false;
2526    }
2527    return true;
2528  }
2529
2530  protected PARTY_RELATIONSHIP parsePARTY_RELATIONSHIP(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2531    PARTY_RELATIONSHIP res = new PARTY_RELATIONSHIP();
2532    next(xpp);
2533    int eventType = nextNoWhitespace(xpp);
2534    while (eventType != XmlPullParser.END_TAG) {
2535    if (!parsePARTY_RELATIONSHIPContent(eventType, xpp, res)) // 1
2536        unknownContent(xpp);
2537      eventType = nextNoWhitespace(xpp);
2538    }
2539    next(xpp);
2540    parseElementClose(res);
2541    return res;
2542  }
2543
2544  protected boolean parsePARTY_RELATIONSHIPContent(int eventType, XmlPullParser xpp, PARTY_RELATIONSHIP res) throws XmlPullParserException, IOException, FHIRFormatError {
2545    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
2546      res.setDetails(parseITEM_STRUCTURE(xpp));
2547    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
2548      res.setTarget(parsePARTY_REF(xpp));
2549    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time_validity")) {
2550      res.setTime_validity(parseDV_INTERVAL(xpp));
2551    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) {
2552      res.setSource(parsePARTY_REF(xpp));
2553    } else if (!parseLOCATABLEContent(eventType, xpp, res)){ //2
2554      return false;
2555    }
2556    return true;
2557  }
2558
2559  protected PARTY_SELF parsePARTY_SELF(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2560    PARTY_SELF res = new PARTY_SELF();
2561    next(xpp);
2562    int eventType = nextNoWhitespace(xpp);
2563    while (eventType != XmlPullParser.END_TAG) {
2564    if (!parsePARTY_SELFContent(eventType, xpp, res)) // 1
2565        unknownContent(xpp);
2566      eventType = nextNoWhitespace(xpp);
2567    }
2568    next(xpp);
2569    parseElementClose(res);
2570    return res;
2571  }
2572
2573  protected boolean parsePARTY_SELFContent(int eventType, XmlPullParser xpp, PARTY_SELF res) throws XmlPullParserException, IOException, FHIRFormatError {
2574    if (!parsePARTY_PROXYContent(eventType, xpp, res)){ //2
2575      return false;
2576    }
2577    return true;
2578  }
2579
2580  protected PERSON parsePERSON(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2581    PERSON res = new PERSON();
2582    next(xpp);
2583    int eventType = nextNoWhitespace(xpp);
2584    while (eventType != XmlPullParser.END_TAG) {
2585    if (!parsePERSONContent(eventType, xpp, res)) // 1
2586        unknownContent(xpp);
2587      eventType = nextNoWhitespace(xpp);
2588    }
2589    next(xpp);
2590    parseElementClose(res);
2591    return res;
2592  }
2593
2594  protected boolean parsePERSONContent(int eventType, XmlPullParser xpp, PERSON res) throws XmlPullParserException, IOException, FHIRFormatError {
2595    if (!parseACTORContent(eventType, xpp, res)){ //2
2596      return false;
2597    }
2598    return true;
2599  }
2600
2601  protected POINT_EVENT parsePOINT_EVENT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2602    POINT_EVENT res = new POINT_EVENT();
2603    next(xpp);
2604    int eventType = nextNoWhitespace(xpp);
2605    while (eventType != XmlPullParser.END_TAG) {
2606    if (!parsePOINT_EVENTContent(eventType, xpp, res)) // 1
2607        unknownContent(xpp);
2608      eventType = nextNoWhitespace(xpp);
2609    }
2610    next(xpp);
2611    parseElementClose(res);
2612    return res;
2613  }
2614
2615  protected boolean parsePOINT_EVENTContent(int eventType, XmlPullParser xpp, POINT_EVENT res) throws XmlPullParserException, IOException, FHIRFormatError {
2616    if (!parseEVENTContent(eventType, xpp, res)){ //2
2617      return false;
2618    }
2619    return true;
2620  }
2621
2622  protected REFERENCE_RANGE parseREFERENCE_RANGE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2623    REFERENCE_RANGE res = new REFERENCE_RANGE();
2624    next(xpp);
2625    int eventType = nextNoWhitespace(xpp);
2626    while (eventType != XmlPullParser.END_TAG) {
2627    if (!parseREFERENCE_RANGEContent(eventType, xpp, res)) // 1
2628        unknownContent(xpp);
2629      eventType = nextNoWhitespace(xpp);
2630    }
2631    next(xpp);
2632    parseElementClose(res);
2633    return res;
2634  }
2635
2636  protected boolean parseREFERENCE_RANGEContent(int eventType, XmlPullParser xpp, REFERENCE_RANGE res) throws XmlPullParserException, IOException, FHIRFormatError {
2637    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("meaning")) {
2638      res.setMeaning(parseDV_TEXT(xpp));
2639    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("range")) {
2640      res.setRange(parseDV_INTERVAL(xpp));
2641    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2642      return false;
2643    }
2644    return true;
2645  }
2646
2647  protected RESOURCE_DESCRIPTION_ITEM parseRESOURCE_DESCRIPTION_ITEM(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2648    RESOURCE_DESCRIPTION_ITEM res = new RESOURCE_DESCRIPTION_ITEM();
2649    next(xpp);
2650    int eventType = nextNoWhitespace(xpp);
2651    while (eventType != XmlPullParser.END_TAG) {
2652    if (!parseRESOURCE_DESCRIPTION_ITEMContent(eventType, xpp, res)) // 1
2653        unknownContent(xpp);
2654      eventType = nextNoWhitespace(xpp);
2655    }
2656    next(xpp);
2657    parseElementClose(res);
2658    return res;
2659  }
2660
2661  protected boolean parseRESOURCE_DESCRIPTION_ITEMContent(int eventType, XmlPullParser xpp, RESOURCE_DESCRIPTION_ITEM res) throws XmlPullParserException, IOException, FHIRFormatError {
2662    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
2663      res.setLanguage(parseCODE_PHRASE(xpp));
2664    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
2665      res.setPurposeElement(parseString(xpp));
2666    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("keywords")) {
2667      res.getKeywordsList().add(parseString(xpp));
2668    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("use")) {
2669      res.setUseElement(parseString(xpp));
2670    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("misuse")) {
2671      res.setMisuseElement(parseString(xpp));
2672    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("copyright")) {
2673      res.setCopyrightElement(parseString(xpp));
2674    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("original_resource_uri")) {
2675      res.getOriginal_resource_uriList().add(parseString(xpp));
2676    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_details")) {
2677      res.getOther_detailsList().add(parseString(xpp));
2678    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2679      return false;
2680    }
2681    return true;
2682  }
2683
2684  protected RESOURCE_DESCRIPTION parseRESOURCE_DESCRIPTION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2685    RESOURCE_DESCRIPTION res = new RESOURCE_DESCRIPTION();
2686    next(xpp);
2687    int eventType = nextNoWhitespace(xpp);
2688    while (eventType != XmlPullParser.END_TAG) {
2689    if (!parseRESOURCE_DESCRIPTIONContent(eventType, xpp, res)) // 1
2690        unknownContent(xpp);
2691      eventType = nextNoWhitespace(xpp);
2692    }
2693    next(xpp);
2694    parseElementClose(res);
2695    return res;
2696  }
2697
2698  protected boolean parseRESOURCE_DESCRIPTIONContent(int eventType, XmlPullParser xpp, RESOURCE_DESCRIPTION res) throws XmlPullParserException, IOException, FHIRFormatError {
2699    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("original_author")) {
2700      res.getOriginal_authorList().add(parseString(xpp));
2701    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_contributors")) {
2702      res.getOther_contributorsList().add(parseString(xpp));
2703    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lifecycle_state")) {
2704      res.setLifecycle_stateElement(parseString(xpp));
2705    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource_package_uri")) {
2706      res.setResource_package_uriElement(parseString(xpp));
2707    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_details")) {
2708      res.getOther_detailsList().add(parseOBJECT_REF(xpp));
2709    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parent_resource")) {
2710      res.setParent_resource(parseAUTHORED_RESOURCE(xpp));
2711    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("details")) {
2712      res.getDetailsList().add(parseRESOURCE_DESCRIPTION_ITEM(xpp));
2713    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2714      return false;
2715    }
2716    return true;
2717  }
2718
2719  protected REVISION_HISTORY_ITEM parseREVISION_HISTORY_ITEM(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2720    REVISION_HISTORY_ITEM res = new REVISION_HISTORY_ITEM();
2721    next(xpp);
2722    int eventType = nextNoWhitespace(xpp);
2723    while (eventType != XmlPullParser.END_TAG) {
2724    if (!parseREVISION_HISTORY_ITEMContent(eventType, xpp, res)) // 1
2725        unknownContent(xpp);
2726      eventType = nextNoWhitespace(xpp);
2727    }
2728    next(xpp);
2729    parseElementClose(res);
2730    return res;
2731  }
2732
2733  protected boolean parseREVISION_HISTORY_ITEMContent(int eventType, XmlPullParser xpp, REVISION_HISTORY_ITEM res) throws XmlPullParserException, IOException, FHIRFormatError {
2734    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version_id")) {
2735      res.setVersion_id(parseOBJECT_VERSION_ID(xpp));
2736    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("audits")) {
2737      res.getAuditsList().add(parseAUDIT_DETAILS(xpp));
2738    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2739      return false;
2740    }
2741    return true;
2742  }
2743
2744  protected REVISION_HISTORY parseREVISION_HISTORY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2745    REVISION_HISTORY res = new REVISION_HISTORY();
2746    next(xpp);
2747    int eventType = nextNoWhitespace(xpp);
2748    while (eventType != XmlPullParser.END_TAG) {
2749    if (!parseREVISION_HISTORYContent(eventType, xpp, res)) // 1
2750        unknownContent(xpp);
2751      eventType = nextNoWhitespace(xpp);
2752    }
2753    next(xpp);
2754    parseElementClose(res);
2755    return res;
2756  }
2757
2758  protected boolean parseREVISION_HISTORYContent(int eventType, XmlPullParser xpp, REVISION_HISTORY res) throws XmlPullParserException, IOException, FHIRFormatError {
2759    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("most_recent_version")) {
2760      res.setMost_recent_versionElement(parseString(xpp));
2761    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("most_recent_version_time_committed")) {
2762      res.setMost_recent_version_time_committedElement(parseString(xpp));
2763    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2764      return false;
2765    }
2766    return true;
2767  }
2768
2769  protected ROLE parseROLE(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2770    ROLE res = new ROLE();
2771    next(xpp);
2772    int eventType = nextNoWhitespace(xpp);
2773    while (eventType != XmlPullParser.END_TAG) {
2774    if (!parseROLEContent(eventType, xpp, res)) // 1
2775        unknownContent(xpp);
2776      eventType = nextNoWhitespace(xpp);
2777    }
2778    next(xpp);
2779    parseElementClose(res);
2780    return res;
2781  }
2782
2783  protected boolean parseROLEContent(int eventType, XmlPullParser xpp, ROLE res) throws XmlPullParserException, IOException, FHIRFormatError {
2784    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time_validity")) {
2785      res.setTime_validity(parseDV_INTERVAL(xpp));
2786    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("performer")) {
2787      res.setPerformer(parsePARTY_REF(xpp));
2788    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("capabilities")) {
2789      res.getCapabilitiesList().add(parseCAPABILITY(xpp));
2790    } else if (!parsePARTYContent(eventType, xpp, res)){ //2
2791      return false;
2792    }
2793    return true;
2794  }
2795
2796  protected SECTION parseSECTION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2797    SECTION res = new SECTION();
2798    next(xpp);
2799    int eventType = nextNoWhitespace(xpp);
2800    while (eventType != XmlPullParser.END_TAG) {
2801    if (!parseSECTIONContent(eventType, xpp, res)) // 1
2802        unknownContent(xpp);
2803      eventType = nextNoWhitespace(xpp);
2804    }
2805    next(xpp);
2806    parseElementClose(res);
2807    return res;
2808  }
2809
2810  protected boolean parseSECTIONContent(int eventType, XmlPullParser xpp, SECTION res) throws XmlPullParserException, IOException, FHIRFormatError {
2811    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("items")) {
2812      res.getItemsList().add(parseCONTENT_ITEM(xpp));
2813    } else if (!parseCONTENT_ITEMContent(eventType, xpp, res)){ //2
2814      return false;
2815    }
2816    return true;
2817  }
2818
2819  protected TEMPLATE_ID parseTEMPLATE_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2820    TEMPLATE_ID res = new TEMPLATE_ID();
2821    next(xpp);
2822    int eventType = nextNoWhitespace(xpp);
2823    while (eventType != XmlPullParser.END_TAG) {
2824    if (!parseTEMPLATE_IDContent(eventType, xpp, res)) // 1
2825        unknownContent(xpp);
2826      eventType = nextNoWhitespace(xpp);
2827    }
2828    next(xpp);
2829    parseElementClose(res);
2830    return res;
2831  }
2832
2833  protected boolean parseTEMPLATE_IDContent(int eventType, XmlPullParser xpp, TEMPLATE_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
2834    if (!parseOBJECT_IDContent(eventType, xpp, res)){ //2
2835      return false;
2836    }
2837    return true;
2838  }
2839
2840  protected TERM_MAPPING parseTERM_MAPPING(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2841    TERM_MAPPING res = new TERM_MAPPING();
2842    next(xpp);
2843    int eventType = nextNoWhitespace(xpp);
2844    while (eventType != XmlPullParser.END_TAG) {
2845    if (!parseTERM_MAPPINGContent(eventType, xpp, res)) // 1
2846        unknownContent(xpp);
2847      eventType = nextNoWhitespace(xpp);
2848    }
2849    next(xpp);
2850    parseElementClose(res);
2851    return res;
2852  }
2853
2854  protected boolean parseTERM_MAPPINGContent(int eventType, XmlPullParser xpp, TERM_MAPPING res) throws XmlPullParserException, IOException, FHIRFormatError {
2855    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("match")) {
2856      res.setMatchElement(parseString(xpp));
2857    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("purpose")) {
2858      res.setPurpose(parseDV_CODED_TEXT(xpp));
2859    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("target")) {
2860      res.setTarget(parseCODE_PHRASE(xpp));
2861    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2862      return false;
2863    }
2864    return true;
2865  }
2866
2867  protected TERMINOLOGY_ID parseTERMINOLOGY_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2868    TERMINOLOGY_ID res = new TERMINOLOGY_ID();
2869    next(xpp);
2870    int eventType = nextNoWhitespace(xpp);
2871    while (eventType != XmlPullParser.END_TAG) {
2872    if (!parseTERMINOLOGY_IDContent(eventType, xpp, res)) // 1
2873        unknownContent(xpp);
2874      eventType = nextNoWhitespace(xpp);
2875    }
2876    next(xpp);
2877    parseElementClose(res);
2878    return res;
2879  }
2880
2881  protected boolean parseTERMINOLOGY_IDContent(int eventType, XmlPullParser xpp, TERMINOLOGY_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
2882    if (!parseOBJECT_IDContent(eventType, xpp, res)){ //2
2883      return false;
2884    }
2885    return true;
2886  }
2887
2888  protected TRANSLATION_DETAILS parseTRANSLATION_DETAILS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2889    TRANSLATION_DETAILS res = new TRANSLATION_DETAILS();
2890    next(xpp);
2891    int eventType = nextNoWhitespace(xpp);
2892    while (eventType != XmlPullParser.END_TAG) {
2893    if (!parseTRANSLATION_DETAILSContent(eventType, xpp, res)) // 1
2894        unknownContent(xpp);
2895      eventType = nextNoWhitespace(xpp);
2896    }
2897    next(xpp);
2898    parseElementClose(res);
2899    return res;
2900  }
2901
2902  protected boolean parseTRANSLATION_DETAILSContent(int eventType, XmlPullParser xpp, TRANSLATION_DETAILS res) throws XmlPullParserException, IOException, FHIRFormatError {
2903    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
2904      res.setLanguage(parseCODE_PHRASE(xpp));
2905    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
2906      res.getAuthorList().add(parseString(xpp));
2907    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accreditation")) {
2908      res.setAccreditationElement(parseString(xpp));
2909    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("other_details")) {
2910      res.getOther_detailsList().add(parseString(xpp));
2911    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2912      return false;
2913    }
2914    return true;
2915  }
2916
2917  protected TranslatedString parseTranslatedString(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2918    TranslatedString res = new TranslatedString();
2919    next(xpp);
2920    int eventType = nextNoWhitespace(xpp);
2921    while (eventType != XmlPullParser.END_TAG) {
2922    if (!parseTranslatedStringContent(eventType, xpp, res)) // 1
2923        unknownContent(xpp);
2924      eventType = nextNoWhitespace(xpp);
2925    }
2926    next(xpp);
2927    parseElementClose(res);
2928    return res;
2929  }
2930
2931  protected boolean parseTranslatedStringContent(int eventType, XmlPullParser xpp, TranslatedString res) throws XmlPullParserException, IOException, FHIRFormatError {
2932    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("language")) {
2933      res.setLanguageElement(parseCode(xpp));
2934    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
2935      res.setValueElement(parseString(xpp));
2936    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2937      return false;
2938    }
2939    return true;
2940  }
2941
2942  protected UUID parseUUID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2943    UUID res = new UUID();
2944    next(xpp);
2945    int eventType = nextNoWhitespace(xpp);
2946    while (eventType != XmlPullParser.END_TAG) {
2947    if (!parseUUIDContent(eventType, xpp, res)) // 1
2948        unknownContent(xpp);
2949      eventType = nextNoWhitespace(xpp);
2950    }
2951    next(xpp);
2952    parseElementClose(res);
2953    return res;
2954  }
2955
2956  protected boolean parseUUIDContent(int eventType, XmlPullParser xpp, UUID res) throws XmlPullParserException, IOException, FHIRFormatError {
2957    if (!parseUIDContent(eventType, xpp, res)){ //2
2958      return false;
2959    }
2960    return true;
2961  }
2962
2963  protected VERSION_TREE_ID parseVERSION_TREE_ID(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2964    VERSION_TREE_ID res = new VERSION_TREE_ID();
2965    next(xpp);
2966    int eventType = nextNoWhitespace(xpp);
2967    while (eventType != XmlPullParser.END_TAG) {
2968    if (!parseVERSION_TREE_IDContent(eventType, xpp, res)) // 1
2969        unknownContent(xpp);
2970      eventType = nextNoWhitespace(xpp);
2971    }
2972    next(xpp);
2973    parseElementClose(res);
2974    return res;
2975  }
2976
2977  protected boolean parseVERSION_TREE_IDContent(int eventType, XmlPullParser xpp, VERSION_TREE_ID res) throws XmlPullParserException, IOException, FHIRFormatError {
2978    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
2979      res.setValueElement(parseString(xpp));
2980    } else if (!parseBaseContent(eventType, xpp, res)){ //2
2981      return false;
2982    }
2983    return true;
2984  }
2985
2986  protected VERSIONED_COMPOSITION parseVERSIONED_COMPOSITION(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
2987    VERSIONED_COMPOSITION res = new VERSIONED_COMPOSITION();
2988    next(xpp);
2989    int eventType = nextNoWhitespace(xpp);
2990    while (eventType != XmlPullParser.END_TAG) {
2991    if (!parseVERSIONED_COMPOSITIONContent(eventType, xpp, res)) // 1
2992        unknownContent(xpp);
2993      eventType = nextNoWhitespace(xpp);
2994    }
2995    next(xpp);
2996    parseElementClose(res);
2997    return res;
2998  }
2999
3000  protected boolean parseVERSIONED_COMPOSITIONContent(int eventType, XmlPullParser xpp, VERSIONED_COMPOSITION res) throws XmlPullParserException, IOException, FHIRFormatError {
3001    if (!parseVERSIONED_OBJECTContent(eventType, xpp, res)){ //2
3002      return false;
3003    }
3004    return true;
3005  }
3006
3007  protected VERSIONED_EHR_ACCESS parseVERSIONED_EHR_ACCESS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3008    VERSIONED_EHR_ACCESS res = new VERSIONED_EHR_ACCESS();
3009    next(xpp);
3010    int eventType = nextNoWhitespace(xpp);
3011    while (eventType != XmlPullParser.END_TAG) {
3012    if (!parseVERSIONED_EHR_ACCESSContent(eventType, xpp, res)) // 1
3013        unknownContent(xpp);
3014      eventType = nextNoWhitespace(xpp);
3015    }
3016    next(xpp);
3017    parseElementClose(res);
3018    return res;
3019  }
3020
3021  protected boolean parseVERSIONED_EHR_ACCESSContent(int eventType, XmlPullParser xpp, VERSIONED_EHR_ACCESS res) throws XmlPullParserException, IOException, FHIRFormatError {
3022    if (!parseVERSIONED_OBJECTContent(eventType, xpp, res)){ //2
3023      return false;
3024    }
3025    return true;
3026  }
3027
3028  protected VERSIONED_EHR_STATUS parseVERSIONED_EHR_STATUS(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3029    VERSIONED_EHR_STATUS res = new VERSIONED_EHR_STATUS();
3030    next(xpp);
3031    int eventType = nextNoWhitespace(xpp);
3032    while (eventType != XmlPullParser.END_TAG) {
3033    if (!parseVERSIONED_EHR_STATUSContent(eventType, xpp, res)) // 1
3034        unknownContent(xpp);
3035      eventType = nextNoWhitespace(xpp);
3036    }
3037    next(xpp);
3038    parseElementClose(res);
3039    return res;
3040  }
3041
3042  protected boolean parseVERSIONED_EHR_STATUSContent(int eventType, XmlPullParser xpp, VERSIONED_EHR_STATUS res) throws XmlPullParserException, IOException, FHIRFormatError {
3043    if (!parseVERSIONED_OBJECTContent(eventType, xpp, res)){ //2
3044      return false;
3045    }
3046    return true;
3047  }
3048
3049  protected VERSIONED_FOLDER parseVERSIONED_FOLDER(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3050    VERSIONED_FOLDER res = new VERSIONED_FOLDER();
3051    next(xpp);
3052    int eventType = nextNoWhitespace(xpp);
3053    while (eventType != XmlPullParser.END_TAG) {
3054    if (!parseVERSIONED_FOLDERContent(eventType, xpp, res)) // 1
3055        unknownContent(xpp);
3056      eventType = nextNoWhitespace(xpp);
3057    }
3058    next(xpp);
3059    parseElementClose(res);
3060    return res;
3061  }
3062
3063  protected boolean parseVERSIONED_FOLDERContent(int eventType, XmlPullParser xpp, VERSIONED_FOLDER res) throws XmlPullParserException, IOException, FHIRFormatError {
3064    if (!parseVERSIONED_OBJECTContent(eventType, xpp, res)){ //2
3065      return false;
3066    }
3067    return true;
3068  }
3069
3070  protected VERSIONED_OBJECT parseVERSIONED_OBJECT(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3071    VERSIONED_OBJECT res = new VERSIONED_OBJECT();
3072    next(xpp);
3073    int eventType = nextNoWhitespace(xpp);
3074    while (eventType != XmlPullParser.END_TAG) {
3075    if (!parseVERSIONED_OBJECTContent(eventType, xpp, res)) // 1
3076        unknownContent(xpp);
3077      eventType = nextNoWhitespace(xpp);
3078    }
3079    next(xpp);
3080    parseElementClose(res);
3081    return res;
3082  }
3083
3084  protected boolean parseVERSIONED_OBJECTContent(int eventType, XmlPullParser xpp, VERSIONED_OBJECT res) throws XmlPullParserException, IOException, FHIRFormatError {
3085    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uid")) {
3086      res.setUid(parseHIER_OBJECT_ID(xpp));
3087    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("owner_id")) {
3088      res.setOwner_id(parseOBJECT_REF(xpp));
3089    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("time_created")) {
3090      res.setTime_created(parseDV_DATE_TIME(xpp));
3091    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3092      return false;
3093    }
3094    return true;
3095  }
3096
3097  protected VERSIONED_PARTY parseVERSIONED_PARTY(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3098    VERSIONED_PARTY res = new VERSIONED_PARTY();
3099    next(xpp);
3100    int eventType = nextNoWhitespace(xpp);
3101    while (eventType != XmlPullParser.END_TAG) {
3102    if (!parseVERSIONED_PARTYContent(eventType, xpp, res)) // 1
3103        unknownContent(xpp);
3104      eventType = nextNoWhitespace(xpp);
3105    }
3106    next(xpp);
3107    parseElementClose(res);
3108    return res;
3109  }
3110
3111  protected boolean parseVERSIONED_PARTYContent(int eventType, XmlPullParser xpp, VERSIONED_PARTY res) throws XmlPullParserException, IOException, FHIRFormatError {
3112    if (!parseVERSIONED_OBJECTContent(eventType, xpp, res)){ //2
3113      return false;
3114    }
3115    return true;
3116  }
3117
3118  protected WebTemplate parseWebTemplate(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3119    WebTemplate res = new WebTemplate();
3120    next(xpp);
3121    int eventType = nextNoWhitespace(xpp);
3122    while (eventType != XmlPullParser.END_TAG) {
3123    if (!parseWebTemplateContent(eventType, xpp, res)) // 1
3124        unknownContent(xpp);
3125      eventType = nextNoWhitespace(xpp);
3126    }
3127    next(xpp);
3128    parseElementClose(res);
3129    return res;
3130  }
3131
3132  protected boolean parseWebTemplateContent(int eventType, XmlPullParser xpp, WebTemplate res) throws XmlPullParserException, IOException, FHIRFormatError {
3133    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("templateId")) {
3134      res.setTemplateIdElement(parseString(xpp));
3135    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) {
3136      res.setVersionElement(parseString(xpp));
3137    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("semver")) {
3138      res.setSemverElement(parseString(xpp));
3139    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("defaultLanguage")) {
3140      res.setDefaultLanguageElement(parseString(xpp));
3141    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("languages")) {
3142      res.getLanguagesList().add(parseString(xpp));
3143    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tree")) {
3144      res.setTree(parseWebTemplateItem(xpp));
3145    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3146      return false;
3147    }
3148    return true;
3149  }
3150
3151  protected WebTemplateInput parseWebTemplateInput(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3152    WebTemplateInput res = new WebTemplateInput();
3153    next(xpp);
3154    int eventType = nextNoWhitespace(xpp);
3155    while (eventType != XmlPullParser.END_TAG) {
3156    if (!parseWebTemplateInputContent(eventType, xpp, res)) // 1
3157        unknownContent(xpp);
3158      eventType = nextNoWhitespace(xpp);
3159    }
3160    next(xpp);
3161    parseElementClose(res);
3162    return res;
3163  }
3164
3165  protected boolean parseWebTemplateInputContent(int eventType, XmlPullParser xpp, WebTemplateInput res) throws XmlPullParserException, IOException, FHIRFormatError {
3166    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suffix")) {
3167      res.setSuffixElement(parseString(xpp));
3168    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) {
3169      res.setTypeElement(parseCode(xpp));
3170    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("defaultValue")) {
3171      res.setDefaultValue(parseNativePrimitive(xpp));
3172    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("terminology")) {
3173      res.setTerminologyElement(parseCode(xpp));
3174    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("validation")) {
3175      res.setValidation(parseWebTemplateInputValidation(xpp));
3176    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("list")) {
3177      res.getListList().add(parseWebTemplateInputListItem(xpp));
3178    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("listOpen")) {
3179      res.setListOpenElement(parseBoolean(xpp));
3180    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3181      return false;
3182    }
3183    return true;
3184  }
3185
3186  protected WebTemplateInputListItem parseWebTemplateInputListItem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3187    WebTemplateInputListItem res = new WebTemplateInputListItem();
3188    next(xpp);
3189    int eventType = nextNoWhitespace(xpp);
3190    while (eventType != XmlPullParser.END_TAG) {
3191    if (!parseWebTemplateInputListItemContent(eventType, xpp, res)) // 1
3192        unknownContent(xpp);
3193      eventType = nextNoWhitespace(xpp);
3194    }
3195    next(xpp);
3196    parseElementClose(res);
3197    return res;
3198  }
3199
3200  protected boolean parseWebTemplateInputListItemContent(int eventType, XmlPullParser xpp, WebTemplateInputListItem res) throws XmlPullParserException, IOException, FHIRFormatError {
3201    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
3202      res.setValueElement(parseCode(xpp));
3203    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) {
3204      res.setLabelElement(parseString(xpp));
3205    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("ordinal")) {
3206      res.setOrdinalElement(parseString(xpp));
3207    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("localizedLabels")) {
3208      res.getLocalizedLabelsList().add(parseTranslatedString(xpp));
3209    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("localizedDescriptions")) {
3210      res.getLocalizedDescriptionsList().add(parseTranslatedString(xpp));
3211    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("currentStates")) {
3212      res.setCurrentStatesElement(parseString(xpp));
3213    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("range")) {
3214      res.setRangeElement(parseString(xpp));
3215    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precision")) {
3216      res.setPrecisionElement(parseString(xpp));
3217    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("termBindings")) {
3218      res.getTermBindingsList().add(parseWebTemplateTermBinding(xpp));
3219    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3220      return false;
3221    }
3222    return true;
3223  }
3224
3225  protected WebTemplateInputValidation parseWebTemplateInputValidation(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3226    WebTemplateInputValidation res = new WebTemplateInputValidation();
3227    next(xpp);
3228    int eventType = nextNoWhitespace(xpp);
3229    while (eventType != XmlPullParser.END_TAG) {
3230    if (!parseWebTemplateInputValidationContent(eventType, xpp, res)) // 1
3231        unknownContent(xpp);
3232      eventType = nextNoWhitespace(xpp);
3233    }
3234    next(xpp);
3235    parseElementClose(res);
3236    return res;
3237  }
3238
3239  protected boolean parseWebTemplateInputValidationContent(int eventType, XmlPullParser xpp, WebTemplateInputValidation res) throws XmlPullParserException, IOException, FHIRFormatError {
3240    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("range")) {
3241      res.setRange(parseWebTemplateInputValidationRange(xpp));
3242    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("precision")) {
3243      res.setPrecision(parseWebTemplateInputValidationRange(xpp));
3244    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3245      return false;
3246    }
3247    return true;
3248  }
3249
3250  protected WebTemplateInputValidationRange parseWebTemplateInputValidationRange(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3251    WebTemplateInputValidationRange res = new WebTemplateInputValidationRange();
3252    next(xpp);
3253    int eventType = nextNoWhitespace(xpp);
3254    while (eventType != XmlPullParser.END_TAG) {
3255    if (!parseWebTemplateInputValidationRangeContent(eventType, xpp, res)) // 1
3256        unknownContent(xpp);
3257      eventType = nextNoWhitespace(xpp);
3258    }
3259    next(xpp);
3260    parseElementClose(res);
3261    return res;
3262  }
3263
3264  protected boolean parseWebTemplateInputValidationRangeContent(int eventType, XmlPullParser xpp, WebTemplateInputValidationRange res) throws XmlPullParserException, IOException, FHIRFormatError {
3265    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("minOp")) {
3266      res.setMinOpElement(parseCode(xpp));
3267    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
3268      res.setMinElement(parseDecimal(xpp));
3269    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("maxOp")) {
3270      res.setMaxOpElement(parseCode(xpp));
3271    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
3272      res.setMaxElement(parseDecimal(xpp));
3273    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3274      return false;
3275    }
3276    return true;
3277  }
3278
3279  protected WebTemplateItem parseWebTemplateItem(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3280    WebTemplateItem res = new WebTemplateItem();
3281    next(xpp);
3282    int eventType = nextNoWhitespace(xpp);
3283    while (eventType != XmlPullParser.END_TAG) {
3284    if (!parseWebTemplateItemContent(eventType, xpp, res)) // 1
3285        unknownContent(xpp);
3286      eventType = nextNoWhitespace(xpp);
3287    }
3288    next(xpp);
3289    parseElementClose(res);
3290    return res;
3291  }
3292
3293  protected boolean parseWebTemplateItemContent(int eventType, XmlPullParser xpp, WebTemplateItem res) throws XmlPullParserException, IOException, FHIRFormatError {
3294    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("id")) {
3295      res.setIdElement(parseString(xpp));
3296    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("depth")) {
3297      res.setDepthElement(parseInteger(xpp));
3298    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
3299      res.setNameElement(parseString(xpp));
3300    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("localizedName")) {
3301      res.setLocalizedNameElement(parseString(xpp));
3302    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("rmType")) {
3303      res.setRmTypeElement(parseCode(xpp));
3304    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("nodeId")) {
3305      res.setNodeIdElement(parseString(xpp));
3306    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("min")) {
3307      res.setMinElement(parseString(xpp));
3308    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("max")) {
3309      res.setMaxElement(parseString(xpp));
3310    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("dependsOn")) {
3311      res.setDependsOnElement(parseString(xpp));
3312    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("localizedNames")) {
3313      res.getLocalizedNamesList().add(parseTranslatedString(xpp));
3314    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("localizedDescriptions")) {
3315      res.getLocalizedDescriptionsList().add(parseTranslatedString(xpp));
3316    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("annotations")) {
3317      res.setAnnotations(parseAnnotations(xpp));
3318    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("archetype_id")) {
3319      res.setArchetype_idElement(parseString(xpp));
3320    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("aqlPath")) {
3321      res.setAqlPathElement(parseString(xpp));
3322    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian_namespace")) {
3323      res.setCustodian_namespaceElement(parseString(xpp));
3324    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("custodian_organisation")) {
3325      res.setCustodian_organisationElement(parseString(xpp));
3326    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("lifecycleState")) {
3327      res.setLifecycleStateElement(parseCode(xpp));
3328    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("original_namespace")) {
3329      res.setOriginal_namespaceElement(parseString(xpp));
3330    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("original_publisher")) {
3331      res.setOriginal_publisherElement(parseString(xpp));
3332    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("proportionTypes")) {
3333      res.setProportionTypesElement(parseCode(xpp));
3334    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("revision")) {
3335      res.setRevisionElement(parseString(xpp));
3336    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inContext")) {
3337      res.setInContextElement(parseBoolean(xpp));
3338    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("inputs")) {
3339      res.getInputsList().add(parseWebTemplateInput(xpp));
3340    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("termBindings")) {
3341      res.getTermBindingsList().add(parseWebTemplateTermBinding(xpp));
3342    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("children")) {
3343      res.getChildrenList().add(parseWebTemplateItem(xpp));
3344    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3345      return false;
3346    }
3347    return true;
3348  }
3349
3350  protected WebTemplateTermBinding parseWebTemplateTermBinding(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3351    WebTemplateTermBinding res = new WebTemplateTermBinding();
3352    next(xpp);
3353    int eventType = nextNoWhitespace(xpp);
3354    while (eventType != XmlPullParser.END_TAG) {
3355    if (!parseWebTemplateTermBindingContent(eventType, xpp, res)) // 1
3356        unknownContent(xpp);
3357      eventType = nextNoWhitespace(xpp);
3358    }
3359    next(xpp);
3360    parseElementClose(res);
3361    return res;
3362  }
3363
3364  protected boolean parseWebTemplateTermBindingContent(int eventType, XmlPullParser xpp, WebTemplateTermBinding res) throws XmlPullParserException, IOException, FHIRFormatError {
3365    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
3366      res.setCodeElement(parseCode(xpp));
3367    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
3368      res.setValue(parseWebTemplateTermBindingValue(xpp));
3369    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3370      return false;
3371    }
3372    return true;
3373  }
3374
3375  protected WebTemplateTermBindingValue parseWebTemplateTermBindingValue(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3376    WebTemplateTermBindingValue res = new WebTemplateTermBindingValue();
3377    next(xpp);
3378    int eventType = nextNoWhitespace(xpp);
3379    while (eventType != XmlPullParser.END_TAG) {
3380    if (!parseWebTemplateTermBindingValueContent(eventType, xpp, res)) // 1
3381        unknownContent(xpp);
3382      eventType = nextNoWhitespace(xpp);
3383    }
3384    next(xpp);
3385    parseElementClose(res);
3386    return res;
3387  }
3388
3389  protected boolean parseWebTemplateTermBindingValueContent(int eventType, XmlPullParser xpp, WebTemplateTermBindingValue res) throws XmlPullParserException, IOException, FHIRFormatError {
3390    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
3391      res.setValueElement(parseString(xpp));
3392    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("terminologyId")) {
3393      res.setTerminologyIdElement(parseString(xpp));
3394    } else if (!parseBaseContent(eventType, xpp, res)){ //2
3395      return false;
3396    }
3397    return true;
3398  }
3399
3400
3401  
3402  @Override
3403  protected Resource parseResource(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3404    if (xpp == null) {
3405      throw new IOException("xpp == null!");
3406
3407    } else {
3408      throw new FHIRFormatError("Unknown resource type "+xpp.getName()+"");
3409    }
3410  }
3411
3412  protected DataType parseType(String prefix, XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
3413    if (prefix == null) {
3414      throw new IOException("prefix == null!");
3415    } else if (xpp == null) {
3416      throw new IOException("xpp == null!");
3417    } else if (xpp.getName().equals(prefix+"Date")) {
3418      return parseDate(xpp);
3419    } else if (xpp.getName().equals(prefix+"DateTime")) {
3420      return parseDateTime(xpp);
3421    } else if (xpp.getName().equals(prefix+"Code")) {
3422      return parseCode(xpp);
3423    } else if (xpp.getName().equals(prefix+"String")) {
3424      return parseString(xpp);
3425    } else if (xpp.getName().equals(prefix+"Integer")) {
3426      return parseInteger(xpp);
3427    } else if (xpp.getName().equals(prefix+"Integer64")) {
3428      return parseInteger64(xpp);
3429    } else if (xpp.getName().equals(prefix+"Oid")) {
3430      return parseOid(xpp);
3431    } else if (xpp.getName().equals(prefix+"Canonical")) {
3432      return parseCanonical(xpp);
3433    } else if (xpp.getName().equals(prefix+"Uri")) {
3434      return parseUri(xpp);
3435    } else if (xpp.getName().equals(prefix+"Uuid")) {
3436      return parseUuid(xpp);
3437    } else if (xpp.getName().equals(prefix+"Url")) {
3438      return parseUrl(xpp);
3439    } else if (xpp.getName().equals(prefix+"Instant")) {
3440      return parseInstant(xpp);
3441    } else if (xpp.getName().equals(prefix+"Boolean")) {
3442      return parseBoolean(xpp);
3443    } else if (xpp.getName().equals(prefix+"Base64Binary")) {
3444      return parseBase64Binary(xpp);
3445    } else if (xpp.getName().equals(prefix+"UnsignedInt")) {
3446      return parseUnsignedInt(xpp);
3447    } else if (xpp.getName().equals(prefix+"Markdown")) {
3448      return parseMarkdown(xpp);
3449    } else if (xpp.getName().equals(prefix+"Time")) {
3450      return parseTime(xpp);
3451    } else if (xpp.getName().equals(prefix+"Id")) {
3452      return parseId(xpp);
3453    } else if (xpp.getName().equals(prefix+"PositiveInt")) {
3454      return parsePositiveInt(xpp);
3455    } else if (xpp.getName().equals(prefix+"Decimal")) {
3456      return parseDecimal(xpp);
3457
3458    } else {
3459      throw new FHIRFormatError("Unknown type "+xpp.getName());
3460    }
3461  }
3462
3463  protected DataType parseType(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
3464    if (type == null) {
3465      throw new IOException("type == null!");
3466    } else if (xpp == null) {
3467      throw new IOException("xpp == null!");
3468    } else if (type.equals("date")) {
3469      return parseDate(xpp);
3470    } else if (type.equals("dateTime")) {
3471      return parseDateTime(xpp);
3472    } else if (type.equals("code")) {
3473      return parseCode(xpp);
3474    } else if (type.equals("string")) {
3475      return parseString(xpp);
3476    } else if (type.equals("integer")) {
3477      return parseInteger(xpp);
3478    } else if (type.equals("integer64")) {
3479      return parseInteger64(xpp);
3480    } else if (type.equals("oid")) {
3481      return parseOid(xpp);
3482    } else if (type.equals("canonical")) {
3483      return parseCanonical(xpp);
3484    } else if (type.equals("uri")) {
3485      return parseUri(xpp);
3486    } else if (type.equals("uuid")) {
3487      return parseUuid(xpp);
3488    } else if (type.equals("url")) {
3489      return parseUrl(xpp);
3490    } else if (type.equals("instant")) {
3491      return parseInstant(xpp);
3492    } else if (type.equals("boolean")) {
3493      return parseBoolean(xpp);
3494    } else if (type.equals("base64Binary")) {
3495      return parseBase64Binary(xpp);
3496    } else if (type.equals("unsignedInt")) {
3497      return parseUnsignedInt(xpp);
3498    } else if (type.equals("markdown")) {
3499      return parseMarkdown(xpp);
3500    } else if (type.equals("time")) {
3501      return parseTime(xpp);
3502    } else if (type.equals("id")) {
3503      return parseId(xpp);
3504    } else if (type.equals("positiveInt")) {
3505      return parsePositiveInt(xpp);
3506    } else if (type.equals("decimal")) {
3507      return parseDecimal(xpp);
3508
3509    } else {
3510      throw new FHIRFormatError("Unknown type "+type);
3511    }
3512  }
3513
3514  public Base parseFragment(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
3515    if (type == null) {
3516      throw new IOException("type == null!");
3517    } else if (xpp == null) {
3518      throw new IOException("xpp == null!");
3519    } else if (type.equals("ACTION")) {
3520      return parseACTION(xpp);
3521    } else if (type.equals("ACTIVITY")) {
3522      return parseACTIVITY(xpp);
3523    } else if (type.equals("ADDRESS")) {
3524      return parseADDRESS(xpp);
3525    } else if (type.equals("ADMIN_ENTRY")) {
3526      return parseADMIN_ENTRY(xpp);
3527    } else if (type.equals("AGENT")) {
3528      return parseAGENT(xpp);
3529    } else if (type.equals("ARCHETYPE_ID")) {
3530      return parseARCHETYPE_ID(xpp);
3531    } else if (type.equals("ARCHETYPED")) {
3532      return parseARCHETYPED(xpp);
3533    } else if (type.equals("ATTESTATION")) {
3534      return parseATTESTATION(xpp);
3535    } else if (type.equals("AUDIT_DETAILS")) {
3536      return parseAUDIT_DETAILS(xpp);
3537    } else if (type.equals("Annotations")) {
3538      return parseAnnotations(xpp);
3539    } else if (type.equals("CAPABILITY")) {
3540      return parseCAPABILITY(xpp);
3541    } else if (type.equals("CLUSTER")) {
3542      return parseCLUSTER(xpp);
3543    } else if (type.equals("CODE_PHRASE")) {
3544      return parseCODE_PHRASE(xpp);
3545    } else if (type.equals("COMPOSITION")) {
3546      return parseCOMPOSITION(xpp);
3547    } else if (type.equals("CONTACT")) {
3548      return parseCONTACT(xpp);
3549    } else if (type.equals("CONTRIBUTION")) {
3550      return parseCONTRIBUTION(xpp);
3551    } else if (type.equals("DV_BOOLEAN")) {
3552      return parseDV_BOOLEAN(xpp);
3553    } else if (type.equals("DV_CODED_TEXT")) {
3554      return parseDV_CODED_TEXT(xpp);
3555    } else if (type.equals("DV_COUNT")) {
3556      return parseDV_COUNT(xpp);
3557    } else if (type.equals("DV_DATE_TIME")) {
3558      return parseDV_DATE_TIME(xpp);
3559    } else if (type.equals("DV_DATE")) {
3560      return parseDV_DATE(xpp);
3561    } else if (type.equals("DV_DURATION")) {
3562      return parseDV_DURATION(xpp);
3563    } else if (type.equals("DV_EHR_URI")) {
3564      return parseDV_EHR_URI(xpp);
3565    } else if (type.equals("DV_GENERAL_TIME_SPECIFICATION")) {
3566      return parseDV_GENERAL_TIME_SPECIFICATION(xpp);
3567    } else if (type.equals("DV_IDENTIFIER")) {
3568      return parseDV_IDENTIFIER(xpp);
3569    } else if (type.equals("DV_INTERVAL")) {
3570      return parseDV_INTERVAL(xpp);
3571    } else if (type.equals("DV_MULTIMEDIA")) {
3572      return parseDV_MULTIMEDIA(xpp);
3573    } else if (type.equals("DV_ORDINAL")) {
3574      return parseDV_ORDINAL(xpp);
3575    } else if (type.equals("DV_PARAGRAPH")) {
3576      return parseDV_PARAGRAPH(xpp);
3577    } else if (type.equals("DV_PARSABLE")) {
3578      return parseDV_PARSABLE(xpp);
3579    } else if (type.equals("DV_PERIODIC_TIME_SPECIFICATION")) {
3580      return parseDV_PERIODIC_TIME_SPECIFICATION(xpp);
3581    } else if (type.equals("DV_PROPORTION")) {
3582      return parseDV_PROPORTION(xpp);
3583    } else if (type.equals("DV_QUANTITY")) {
3584      return parseDV_QUANTITY(xpp);
3585    } else if (type.equals("DV_SCALE")) {
3586      return parseDV_SCALE(xpp);
3587    } else if (type.equals("DV_STATE")) {
3588      return parseDV_STATE(xpp);
3589    } else if (type.equals("DV_TEXT")) {
3590      return parseDV_TEXT(xpp);
3591    } else if (type.equals("DV_TIME")) {
3592      return parseDV_TIME(xpp);
3593    } else if (type.equals("DV_URI")) {
3594      return parseDV_URI(xpp);
3595    } else if (type.equals("EHR_ACCESS")) {
3596      return parseEHR_ACCESS(xpp);
3597    } else if (type.equals("EHR_STATUS")) {
3598      return parseEHR_STATUS(xpp);
3599    } else if (type.equals("EHR")) {
3600      return parseEHR(xpp);
3601    } else if (type.equals("ELEMENT")) {
3602      return parseELEMENT(xpp);
3603    } else if (type.equals("EVALUATION")) {
3604      return parseEVALUATION(xpp);
3605    } else if (type.equals("EVENT_CONTEXT")) {
3606      return parseEVENT_CONTEXT(xpp);
3607    } else if (type.equals("FEEDER_AUDIT_DETAILS")) {
3608      return parseFEEDER_AUDIT_DETAILS(xpp);
3609    } else if (type.equals("FEEDER_AUDIT")) {
3610      return parseFEEDER_AUDIT(xpp);
3611    } else if (type.equals("FOLDER")) {
3612      return parseFOLDER(xpp);
3613    } else if (type.equals("GENERIC_ID")) {
3614      return parseGENERIC_ID(xpp);
3615    } else if (type.equals("GROUP")) {
3616      return parseGROUP(xpp);
3617    } else if (type.equals("HIER_OBJECT_ID")) {
3618      return parseHIER_OBJECT_ID(xpp);
3619    } else if (type.equals("HISTORY")) {
3620      return parseHISTORY(xpp);
3621    } else if (type.equals("IMPORTED_VERSION")) {
3622      return parseIMPORTED_VERSION(xpp);
3623    } else if (type.equals("INSTRUCTION_DETAILS")) {
3624      return parseINSTRUCTION_DETAILS(xpp);
3625    } else if (type.equals("INSTRUCTION")) {
3626      return parseINSTRUCTION(xpp);
3627    } else if (type.equals("INTERNET_ID")) {
3628      return parseINTERNET_ID(xpp);
3629    } else if (type.equals("INTERVAL_EVENT")) {
3630      return parseINTERVAL_EVENT(xpp);
3631    } else if (type.equals("ISM_TRANSITION")) {
3632      return parseISM_TRANSITION(xpp);
3633    } else if (type.equals("ISO_OID")) {
3634      return parseISO_OID(xpp);
3635    } else if (type.equals("ITEM_LIST")) {
3636      return parseITEM_LIST(xpp);
3637    } else if (type.equals("ITEM_SINGLE")) {
3638      return parseITEM_SINGLE(xpp);
3639    } else if (type.equals("ITEM_TABLE")) {
3640      return parseITEM_TABLE(xpp);
3641    } else if (type.equals("ITEM_TAG")) {
3642      return parseITEM_TAG(xpp);
3643    } else if (type.equals("ITEM_TREE")) {
3644      return parseITEM_TREE(xpp);
3645    } else if (type.equals("LINK")) {
3646      return parseLINK(xpp);
3647    } else if (type.equals("LOCATABLE_REF")) {
3648      return parseLOCATABLE_REF(xpp);
3649    } else if (type.equals("OBJECT_REF")) {
3650      return parseOBJECT_REF(xpp);
3651    } else if (type.equals("OBJECT_VERSION_ID")) {
3652      return parseOBJECT_VERSION_ID(xpp);
3653    } else if (type.equals("OBSERVATION")) {
3654      return parseOBSERVATION(xpp);
3655    } else if (type.equals("ORGANISATION")) {
3656      return parseORGANISATION(xpp);
3657    } else if (type.equals("ORIGINAL_VERSION")) {
3658      return parseORIGINAL_VERSION(xpp);
3659    } else if (type.equals("PARTICIPATION")) {
3660      return parsePARTICIPATION(xpp);
3661    } else if (type.equals("PARTY_IDENTIFIED")) {
3662      return parsePARTY_IDENTIFIED(xpp);
3663    } else if (type.equals("PARTY_IDENTITY")) {
3664      return parsePARTY_IDENTITY(xpp);
3665    } else if (type.equals("PARTY_REF")) {
3666      return parsePARTY_REF(xpp);
3667    } else if (type.equals("PARTY_RELATED")) {
3668      return parsePARTY_RELATED(xpp);
3669    } else if (type.equals("PARTY_RELATIONSHIP")) {
3670      return parsePARTY_RELATIONSHIP(xpp);
3671    } else if (type.equals("PARTY_SELF")) {
3672      return parsePARTY_SELF(xpp);
3673    } else if (type.equals("PERSON")) {
3674      return parsePERSON(xpp);
3675    } else if (type.equals("POINT_EVENT")) {
3676      return parsePOINT_EVENT(xpp);
3677    } else if (type.equals("REFERENCE_RANGE")) {
3678      return parseREFERENCE_RANGE(xpp);
3679    } else if (type.equals("RESOURCE_DESCRIPTION_ITEM")) {
3680      return parseRESOURCE_DESCRIPTION_ITEM(xpp);
3681    } else if (type.equals("RESOURCE_DESCRIPTION")) {
3682      return parseRESOURCE_DESCRIPTION(xpp);
3683    } else if (type.equals("REVISION_HISTORY_ITEM")) {
3684      return parseREVISION_HISTORY_ITEM(xpp);
3685    } else if (type.equals("REVISION_HISTORY")) {
3686      return parseREVISION_HISTORY(xpp);
3687    } else if (type.equals("ROLE")) {
3688      return parseROLE(xpp);
3689    } else if (type.equals("SECTION")) {
3690      return parseSECTION(xpp);
3691    } else if (type.equals("TEMPLATE_ID")) {
3692      return parseTEMPLATE_ID(xpp);
3693    } else if (type.equals("TERM_MAPPING")) {
3694      return parseTERM_MAPPING(xpp);
3695    } else if (type.equals("TERMINOLOGY_ID")) {
3696      return parseTERMINOLOGY_ID(xpp);
3697    } else if (type.equals("TRANSLATION_DETAILS")) {
3698      return parseTRANSLATION_DETAILS(xpp);
3699    } else if (type.equals("TranslatedString")) {
3700      return parseTranslatedString(xpp);
3701    } else if (type.equals("UUID")) {
3702      return parseUUID(xpp);
3703    } else if (type.equals("VERSION_TREE_ID")) {
3704      return parseVERSION_TREE_ID(xpp);
3705    } else if (type.equals("VERSIONED_COMPOSITION")) {
3706      return parseVERSIONED_COMPOSITION(xpp);
3707    } else if (type.equals("VERSIONED_EHR_ACCESS")) {
3708      return parseVERSIONED_EHR_ACCESS(xpp);
3709    } else if (type.equals("VERSIONED_EHR_STATUS")) {
3710      return parseVERSIONED_EHR_STATUS(xpp);
3711    } else if (type.equals("VERSIONED_FOLDER")) {
3712      return parseVERSIONED_FOLDER(xpp);
3713    } else if (type.equals("VERSIONED_OBJECT")) {
3714      return parseVERSIONED_OBJECT(xpp);
3715    } else if (type.equals("VERSIONED_PARTY")) {
3716      return parseVERSIONED_PARTY(xpp);
3717    } else if (type.equals("WebTemplate")) {
3718      return parseWebTemplate(xpp);
3719    } else if (type.equals("WebTemplateInput")) {
3720      return parseWebTemplateInput(xpp);
3721    } else if (type.equals("WebTemplateInputListItem")) {
3722      return parseWebTemplateInputListItem(xpp);
3723    } else if (type.equals("WebTemplateInputValidation")) {
3724      return parseWebTemplateInputValidation(xpp);
3725    } else if (type.equals("WebTemplateInputValidationRange")) {
3726      return parseWebTemplateInputValidationRange(xpp);
3727    } else if (type.equals("WebTemplateItem")) {
3728      return parseWebTemplateItem(xpp);
3729    } else if (type.equals("WebTemplateTermBinding")) {
3730      return parseWebTemplateTermBinding(xpp);
3731    } else if (type.equals("WebTemplateTermBindingValue")) {
3732      return parseWebTemplateTermBindingValue(xpp);
3733      
3734    } else if (type.equals("date")) {
3735      return parseDate(xpp);
3736    } else if (type.equals("dateTime")) {
3737      return parseDateTime(xpp);
3738    } else if (type.equals("code")) {
3739      return parseCode(xpp);
3740    } else if (type.equals("string")) {
3741      return parseString(xpp);
3742    } else if (type.equals("integer")) {
3743      return parseInteger(xpp);
3744    } else if (type.equals("integer64")) {
3745      return parseInteger64(xpp);
3746    } else if (type.equals("oid")) {
3747      return parseOid(xpp);
3748    } else if (type.equals("canonical")) {
3749      return parseCanonical(xpp);
3750    } else if (type.equals("uri")) {
3751      return parseUri(xpp);
3752    } else if (type.equals("uuid")) {
3753      return parseUuid(xpp);
3754    } else if (type.equals("url")) {
3755      return parseUrl(xpp);
3756    } else if (type.equals("instant")) {
3757      return parseInstant(xpp);
3758    } else if (type.equals("boolean")) {
3759      return parseBoolean(xpp);
3760    } else if (type.equals("base64Binary")) {
3761      return parseBase64Binary(xpp);
3762    } else if (type.equals("unsignedInt")) {
3763      return parseUnsignedInt(xpp);
3764    } else if (type.equals("markdown")) {
3765      return parseMarkdown(xpp);
3766    } else if (type.equals("time")) {
3767      return parseTime(xpp);
3768    } else if (type.equals("id")) {
3769      return parseId(xpp);
3770    } else if (type.equals("positiveInt")) {
3771      return parsePositiveInt(xpp);
3772    } else if (type.equals("decimal")) {
3773      return parseDecimal(xpp);
3774    } else {
3775      throw new FHIRFormatError("Unknown type "+type);
3776    }
3777  }
3778
3779  private boolean nameIsTypeName(XmlPullParser xpp, String prefix) throws IOException {  
3780    if (prefix == null) {
3781      throw new IOException("prefix == null!");
3782    } else if (xpp == null) {
3783      throw new IOException("xpp == null!");
3784    } else if (xpp.getName().equals(prefix+"ACTION")) {
3785      return true;
3786    } else if (xpp.getName().equals(prefix+"ACTIVITY")) {
3787      return true;
3788    } else if (xpp.getName().equals(prefix+"ADDRESS")) {
3789      return true;
3790    } else if (xpp.getName().equals(prefix+"ADMIN_ENTRY")) {
3791      return true;
3792    } else if (xpp.getName().equals(prefix+"AGENT")) {
3793      return true;
3794    } else if (xpp.getName().equals(prefix+"ARCHETYPE_ID")) {
3795      return true;
3796    } else if (xpp.getName().equals(prefix+"ARCHETYPED")) {
3797      return true;
3798    } else if (xpp.getName().equals(prefix+"ATTESTATION")) {
3799      return true;
3800    } else if (xpp.getName().equals(prefix+"AUDIT_DETAILS")) {
3801      return true;
3802    } else if (xpp.getName().equals(prefix+"Annotations")) {
3803      return true;
3804    } else if (xpp.getName().equals(prefix+"CAPABILITY")) {
3805      return true;
3806    } else if (xpp.getName().equals(prefix+"CLUSTER")) {
3807      return true;
3808    } else if (xpp.getName().equals(prefix+"CODE_PHRASE")) {
3809      return true;
3810    } else if (xpp.getName().equals(prefix+"COMPOSITION")) {
3811      return true;
3812    } else if (xpp.getName().equals(prefix+"CONTACT")) {
3813      return true;
3814    } else if (xpp.getName().equals(prefix+"CONTRIBUTION")) {
3815      return true;
3816    } else if (xpp.getName().equals(prefix+"DV_BOOLEAN")) {
3817      return true;
3818    } else if (xpp.getName().equals(prefix+"DV_CODED_TEXT")) {
3819      return true;
3820    } else if (xpp.getName().equals(prefix+"DV_COUNT")) {
3821      return true;
3822    } else if (xpp.getName().equals(prefix+"DV_DATE_TIME")) {
3823      return true;
3824    } else if (xpp.getName().equals(prefix+"DV_DATE")) {
3825      return true;
3826    } else if (xpp.getName().equals(prefix+"DV_DURATION")) {
3827      return true;
3828    } else if (xpp.getName().equals(prefix+"DV_EHR_URI")) {
3829      return true;
3830    } else if (xpp.getName().equals(prefix+"DV_GENERAL_TIME_SPECIFICATION")) {
3831      return true;
3832    } else if (xpp.getName().equals(prefix+"DV_IDENTIFIER")) {
3833      return true;
3834    } else if (xpp.getName().equals(prefix+"DV_INTERVAL")) {
3835      return true;
3836    } else if (xpp.getName().equals(prefix+"DV_MULTIMEDIA")) {
3837      return true;
3838    } else if (xpp.getName().equals(prefix+"DV_ORDINAL")) {
3839      return true;
3840    } else if (xpp.getName().equals(prefix+"DV_PARAGRAPH")) {
3841      return true;
3842    } else if (xpp.getName().equals(prefix+"DV_PARSABLE")) {
3843      return true;
3844    } else if (xpp.getName().equals(prefix+"DV_PERIODIC_TIME_SPECIFICATION")) {
3845      return true;
3846    } else if (xpp.getName().equals(prefix+"DV_PROPORTION")) {
3847      return true;
3848    } else if (xpp.getName().equals(prefix+"DV_QUANTITY")) {
3849      return true;
3850    } else if (xpp.getName().equals(prefix+"DV_SCALE")) {
3851      return true;
3852    } else if (xpp.getName().equals(prefix+"DV_STATE")) {
3853      return true;
3854    } else if (xpp.getName().equals(prefix+"DV_TEXT")) {
3855      return true;
3856    } else if (xpp.getName().equals(prefix+"DV_TIME")) {
3857      return true;
3858    } else if (xpp.getName().equals(prefix+"DV_URI")) {
3859      return true;
3860    } else if (xpp.getName().equals(prefix+"EHR_ACCESS")) {
3861      return true;
3862    } else if (xpp.getName().equals(prefix+"EHR_STATUS")) {
3863      return true;
3864    } else if (xpp.getName().equals(prefix+"EHR")) {
3865      return true;
3866    } else if (xpp.getName().equals(prefix+"ELEMENT")) {
3867      return true;
3868    } else if (xpp.getName().equals(prefix+"EVALUATION")) {
3869      return true;
3870    } else if (xpp.getName().equals(prefix+"EVENT_CONTEXT")) {
3871      return true;
3872    } else if (xpp.getName().equals(prefix+"FEEDER_AUDIT_DETAILS")) {
3873      return true;
3874    } else if (xpp.getName().equals(prefix+"FEEDER_AUDIT")) {
3875      return true;
3876    } else if (xpp.getName().equals(prefix+"FOLDER")) {
3877      return true;
3878    } else if (xpp.getName().equals(prefix+"GENERIC_ID")) {
3879      return true;
3880    } else if (xpp.getName().equals(prefix+"GROUP")) {
3881      return true;
3882    } else if (xpp.getName().equals(prefix+"HIER_OBJECT_ID")) {
3883      return true;
3884    } else if (xpp.getName().equals(prefix+"HISTORY")) {
3885      return true;
3886    } else if (xpp.getName().equals(prefix+"IMPORTED_VERSION")) {
3887      return true;
3888    } else if (xpp.getName().equals(prefix+"INSTRUCTION_DETAILS")) {
3889      return true;
3890    } else if (xpp.getName().equals(prefix+"INSTRUCTION")) {
3891      return true;
3892    } else if (xpp.getName().equals(prefix+"INTERNET_ID")) {
3893      return true;
3894    } else if (xpp.getName().equals(prefix+"INTERVAL_EVENT")) {
3895      return true;
3896    } else if (xpp.getName().equals(prefix+"ISM_TRANSITION")) {
3897      return true;
3898    } else if (xpp.getName().equals(prefix+"ISO_OID")) {
3899      return true;
3900    } else if (xpp.getName().equals(prefix+"ITEM_LIST")) {
3901      return true;
3902    } else if (xpp.getName().equals(prefix+"ITEM_SINGLE")) {
3903      return true;
3904    } else if (xpp.getName().equals(prefix+"ITEM_TABLE")) {
3905      return true;
3906    } else if (xpp.getName().equals(prefix+"ITEM_TAG")) {
3907      return true;
3908    } else if (xpp.getName().equals(prefix+"ITEM_TREE")) {
3909      return true;
3910    } else if (xpp.getName().equals(prefix+"LINK")) {
3911      return true;
3912    } else if (xpp.getName().equals(prefix+"LOCATABLE_REF")) {
3913      return true;
3914    } else if (xpp.getName().equals(prefix+"OBJECT_REF")) {
3915      return true;
3916    } else if (xpp.getName().equals(prefix+"OBJECT_VERSION_ID")) {
3917      return true;
3918    } else if (xpp.getName().equals(prefix+"OBSERVATION")) {
3919      return true;
3920    } else if (xpp.getName().equals(prefix+"ORGANISATION")) {
3921      return true;
3922    } else if (xpp.getName().equals(prefix+"ORIGINAL_VERSION")) {
3923      return true;
3924    } else if (xpp.getName().equals(prefix+"PARTICIPATION")) {
3925      return true;
3926    } else if (xpp.getName().equals(prefix+"PARTY_IDENTIFIED")) {
3927      return true;
3928    } else if (xpp.getName().equals(prefix+"PARTY_IDENTITY")) {
3929      return true;
3930    } else if (xpp.getName().equals(prefix+"PARTY_REF")) {
3931      return true;
3932    } else if (xpp.getName().equals(prefix+"PARTY_RELATED")) {
3933      return true;
3934    } else if (xpp.getName().equals(prefix+"PARTY_RELATIONSHIP")) {
3935      return true;
3936    } else if (xpp.getName().equals(prefix+"PARTY_SELF")) {
3937      return true;
3938    } else if (xpp.getName().equals(prefix+"PERSON")) {
3939      return true;
3940    } else if (xpp.getName().equals(prefix+"POINT_EVENT")) {
3941      return true;
3942    } else if (xpp.getName().equals(prefix+"REFERENCE_RANGE")) {
3943      return true;
3944    } else if (xpp.getName().equals(prefix+"RESOURCE_DESCRIPTION_ITEM")) {
3945      return true;
3946    } else if (xpp.getName().equals(prefix+"RESOURCE_DESCRIPTION")) {
3947      return true;
3948    } else if (xpp.getName().equals(prefix+"REVISION_HISTORY_ITEM")) {
3949      return true;
3950    } else if (xpp.getName().equals(prefix+"REVISION_HISTORY")) {
3951      return true;
3952    } else if (xpp.getName().equals(prefix+"ROLE")) {
3953      return true;
3954    } else if (xpp.getName().equals(prefix+"SECTION")) {
3955      return true;
3956    } else if (xpp.getName().equals(prefix+"TEMPLATE_ID")) {
3957      return true;
3958    } else if (xpp.getName().equals(prefix+"TERM_MAPPING")) {
3959      return true;
3960    } else if (xpp.getName().equals(prefix+"TERMINOLOGY_ID")) {
3961      return true;
3962    } else if (xpp.getName().equals(prefix+"TRANSLATION_DETAILS")) {
3963      return true;
3964    } else if (xpp.getName().equals(prefix+"TranslatedString")) {
3965      return true;
3966    } else if (xpp.getName().equals(prefix+"UUID")) {
3967      return true;
3968    } else if (xpp.getName().equals(prefix+"VERSION_TREE_ID")) {
3969      return true;
3970    } else if (xpp.getName().equals(prefix+"VERSIONED_COMPOSITION")) {
3971      return true;
3972    } else if (xpp.getName().equals(prefix+"VERSIONED_EHR_ACCESS")) {
3973      return true;
3974    } else if (xpp.getName().equals(prefix+"VERSIONED_EHR_STATUS")) {
3975      return true;
3976    } else if (xpp.getName().equals(prefix+"VERSIONED_FOLDER")) {
3977      return true;
3978    } else if (xpp.getName().equals(prefix+"VERSIONED_OBJECT")) {
3979      return true;
3980    } else if (xpp.getName().equals(prefix+"VERSIONED_PARTY")) {
3981      return true;
3982    } else if (xpp.getName().equals(prefix+"WebTemplate")) {
3983      return true;
3984    } else if (xpp.getName().equals(prefix+"WebTemplateInput")) {
3985      return true;
3986    } else if (xpp.getName().equals(prefix+"WebTemplateInputListItem")) {
3987      return true;
3988    } else if (xpp.getName().equals(prefix+"WebTemplateInputValidation")) {
3989      return true;
3990    } else if (xpp.getName().equals(prefix+"WebTemplateInputValidationRange")) {
3991      return true;
3992    } else if (xpp.getName().equals(prefix+"WebTemplateItem")) {
3993      return true;
3994    } else if (xpp.getName().equals(prefix+"WebTemplateTermBinding")) {
3995      return true;
3996    } else if (xpp.getName().equals(prefix+"WebTemplateTermBindingValue")) {
3997      return true;
3998
3999    } else if (xpp.getName().equals(prefix+"Date")) {
4000      return true;
4001    } else if (xpp.getName().equals(prefix+"DateTime")) {
4002      return true;
4003    } else if (xpp.getName().equals(prefix+"Code")) {
4004      return true;
4005    } else if (xpp.getName().equals(prefix+"String")) {
4006      return true;
4007    } else if (xpp.getName().equals(prefix+"Integer")) {
4008      return true;
4009    } else if (xpp.getName().equals(prefix+"Integer64")) {
4010      return true;
4011    } else if (xpp.getName().equals(prefix+"Oid")) {
4012      return true;
4013    } else if (xpp.getName().equals(prefix+"Canonical")) {
4014      return true;
4015    } else if (xpp.getName().equals(prefix+"Uri")) {
4016      return true;
4017    } else if (xpp.getName().equals(prefix+"Uuid")) {
4018      return true;
4019    } else if (xpp.getName().equals(prefix+"Url")) {
4020      return true;
4021    } else if (xpp.getName().equals(prefix+"Instant")) {
4022      return true;
4023    } else if (xpp.getName().equals(prefix+"Boolean")) {
4024      return true;
4025    } else if (xpp.getName().equals(prefix+"Base64Binary")) {
4026      return true;
4027    } else if (xpp.getName().equals(prefix+"UnsignedInt")) {
4028      return true;
4029    } else if (xpp.getName().equals(prefix+"Markdown")) {
4030      return true;
4031    } else if (xpp.getName().equals(prefix+"Time")) {
4032      return true;
4033    } else if (xpp.getName().equals(prefix+"Id")) {
4034      return true;
4035    } else if (xpp.getName().equals(prefix+"PositiveInt")) {
4036      return true;
4037    } else if (xpp.getName().equals(prefix+"Decimal")) {
4038      return true;
4039    } else {
4040      return false;
4041    }
4042  }
4043
4044  @Override
4045  protected DataType parseAnyType(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError {
4046    return parseType(xpp, type);
4047  }
4048
4049
4050//----------------- Composer -------------------------------------------------------------------------------------------
4051
4052  protected void composeACCESS_CONTROL_SETTINGS(String name, ACCESS_CONTROL_SETTINGS element) throws IOException {
4053    if (element != null) {
4054      xml.attribute("xsi:type", element.fhirType());
4055      switch (element.fhirType()) {
4056      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4057      }
4058    }
4059  }
4060
4061  protected void composeACCESS_CONTROL_SETTINGSElements(ACCESS_CONTROL_SETTINGS element) throws IOException {
4062    composeBaseElements(element);
4063  }
4064
4065  protected void composeACTOR(String name, ACTOR element) throws IOException {
4066    if (element != null) {
4067      xml.attribute("xsi:type", element.fhirType());
4068      switch (element.fhirType()) {
4069      case "AGENT":
4070        composeAGENT(name, (AGENT) element);
4071        break;
4072      case "GROUP":
4073        composeGROUP(name, (GROUP) element);
4074        break;
4075      case "PERSON":
4076        composePERSON(name, (PERSON) element);
4077        break;
4078      case "ORGANISATION":
4079        composeORGANISATION(name, (ORGANISATION) element);
4080        break;
4081      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4082      }
4083    }
4084  }
4085
4086  protected void composeACTORElements(ACTOR element) throws IOException {
4087    composePARTYElements(element);
4088    if (element.hasLanguages()) { 
4089      for (DV_TEXT e : element.getLanguagesList()) 
4090          composeDV_TEXT("languages", e); // a
4091    }
4092    if (element.hasRoles()) { 
4093      for (PARTY_REF e : element.getRolesList()) 
4094          composePARTY_REF("roles", e); // a
4095    }
4096  }
4097
4098  protected void composeAUTHORED_RESOURCE(String name, AUTHORED_RESOURCE element) throws IOException {
4099    if (element != null) {
4100      xml.attribute("xsi:type", element.fhirType());
4101      switch (element.fhirType()) {
4102      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4103      }
4104    }
4105  }
4106
4107  protected void composeAUTHORED_RESOURCEElements(AUTHORED_RESOURCE element) throws IOException {
4108    composeBaseElements(element);
4109    if (element.hasOriginal_language()) {
4110      composeCODE_PHRASE("original_language", element.getOriginal_language());
4111    }
4112    if (element.hasIs_controlledElement()) {
4113      composeBoolean("is_controlled", element.getIs_controlledElement());
4114    }
4115    if (element.hasTranslations()) { 
4116      for (TRANSLATION_DETAILS e : element.getTranslationsList()) 
4117          composeTRANSLATION_DETAILS("translations", e); // a
4118    }
4119    if (element.hasDescription()) {
4120      composeRESOURCE_DESCRIPTION("description", element.getDescription());
4121    }
4122    if (element.hasRevision_history()) {
4123      composeREVISION_HISTORY("revision_history", element.getRevision_history());
4124    }
4125  }
4126
4127  protected void composeAny(String name, Any element) throws IOException {
4128    if (element != null) {
4129      xml.attribute("xsi:type", element.fhirType());
4130      switch (element.fhirType()) {
4131      case "EHR":
4132        composeEHR(name, (EHR) element);
4133        break;
4134      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4135      }
4136    }
4137  }
4138
4139  protected void composeAnyElements(Any element) throws IOException {
4140    composeBaseElements(element);
4141  }
4142
4143  protected void composeCARE_ENTRY(String name, CARE_ENTRY element) throws IOException {
4144    if (element != null) {
4145      xml.attribute("xsi:type", element.fhirType());
4146      switch (element.fhirType()) {
4147      case "INSTRUCTION":
4148        composeINSTRUCTION(name, (INSTRUCTION) element);
4149        break;
4150      case "OBSERVATION":
4151        composeOBSERVATION(name, (OBSERVATION) element);
4152        break;
4153      case "ACTION":
4154        composeACTION(name, (ACTION) element);
4155        break;
4156      case "EVALUATION":
4157        composeEVALUATION(name, (EVALUATION) element);
4158        break;
4159      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4160      }
4161    }
4162  }
4163
4164  protected void composeCARE_ENTRYElements(CARE_ENTRY element) throws IOException {
4165    composeENTRYElements(element);
4166    if (element.hasProtocol()) {
4167      composeITEM_STRUCTURE("protocol", element.getProtocol());
4168    }
4169    if (element.hasGuideline_id()) {
4170      composeOBJECT_REF("guideline_id", element.getGuideline_id());
4171    }
4172  }
4173
4174  protected void composeCONTENT_ITEM(String name, CONTENT_ITEM element) throws IOException {
4175    if (element != null) {
4176      xml.attribute("xsi:type", element.fhirType());
4177      switch (element.fhirType()) {
4178      case "SECTION":
4179        composeSECTION(name, (SECTION) element);
4180        break;
4181      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4182      }
4183    }
4184  }
4185
4186  protected void composeCONTENT_ITEMElements(CONTENT_ITEM element) throws IOException {
4187    composeLOCATABLEElements(element);
4188  }
4189
4190  protected void composeDATA_STRUCTURE(String name, DATA_STRUCTURE element) throws IOException {
4191    if (element != null) {
4192      xml.attribute("xsi:type", element.fhirType());
4193      switch (element.fhirType()) {
4194      case "HISTORY":
4195        composeHISTORY(name, (HISTORY) element);
4196        break;
4197      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4198      }
4199    }
4200  }
4201
4202  protected void composeDATA_STRUCTUREElements(DATA_STRUCTURE element) throws IOException {
4203    composeLOCATABLEElements(element);
4204  }
4205
4206  protected void composeDATA_VALUE(String name, DATA_VALUE element) throws IOException {
4207    if (element != null) {
4208      xml.attribute("xsi:type", element.fhirType());
4209      switch (element.fhirType()) {
4210      case "DV-TEXT":
4211        composeDV_TEXT(name, (DV_TEXT) element);
4212        break;
4213      case "DV-IDENTIFIER":
4214        composeDV_IDENTIFIER(name, (DV_IDENTIFIER) element);
4215        break;
4216      case "DV-BOOLEAN":
4217        composeDV_BOOLEAN(name, (DV_BOOLEAN) element);
4218        break;
4219      case "DV-PARAGRAPH":
4220        composeDV_PARAGRAPH(name, (DV_PARAGRAPH) element);
4221        break;
4222      case "DV-URI":
4223        composeDV_URI(name, (DV_URI) element);
4224        break;
4225      case "DV-STATE":
4226        composeDV_STATE(name, (DV_STATE) element);
4227        break;
4228      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4229      }
4230    }
4231  }
4232
4233  protected void composeDATA_VALUEElements(DATA_VALUE element) throws IOException {
4234    composeBaseElements(element);
4235  }
4236
4237  protected void composeDV_ABSOLUTE_QUANTITY(String name, DV_ABSOLUTE_QUANTITY element) throws IOException {
4238    if (element != null) {
4239      xml.attribute("xsi:type", element.fhirType());
4240      switch (element.fhirType()) {
4241      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4242      }
4243    }
4244  }
4245
4246  protected void composeDV_ABSOLUTE_QUANTITYElements(DV_ABSOLUTE_QUANTITY element) throws IOException {
4247    composeDV_QUANTIFIEDElements(element);
4248  }
4249
4250  protected void composeDV_AMOUNT(String name, DV_AMOUNT element) throws IOException {
4251    if (element != null) {
4252      xml.attribute("xsi:type", element.fhirType());
4253      switch (element.fhirType()) {
4254      case "DV-DURATION":
4255        composeDV_DURATION(name, (DV_DURATION) element);
4256        break;
4257      case "DV-COUNT":
4258        composeDV_COUNT(name, (DV_COUNT) element);
4259        break;
4260      case "DV-PROPORTION":
4261        composeDV_PROPORTION(name, (DV_PROPORTION) element);
4262        break;
4263      case "DV-QUANTITY":
4264        composeDV_QUANTITY(name, (DV_QUANTITY) element);
4265        break;
4266      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4267      }
4268    }
4269  }
4270
4271  protected void composeDV_AMOUNTElements(DV_AMOUNT element) throws IOException {
4272    composeDV_QUANTIFIEDElements(element);
4273    if (element.hasAccuracy_is_percentElement()) {
4274      composeBoolean("accuracy_is_percent", element.getAccuracy_is_percentElement());
4275    }
4276  }
4277
4278  protected void composeDV_ENCAPSULATED(String name, DV_ENCAPSULATED element) throws IOException {
4279    if (element != null) {
4280      xml.attribute("xsi:type", element.fhirType());
4281      switch (element.fhirType()) {
4282      case "DV-MULTIMEDIA":
4283        composeDV_MULTIMEDIA(name, (DV_MULTIMEDIA) element);
4284        break;
4285      case "DV-PARSABLE":
4286        composeDV_PARSABLE(name, (DV_PARSABLE) element);
4287        break;
4288      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4289      }
4290    }
4291  }
4292
4293  protected void composeDV_ENCAPSULATEDElements(DV_ENCAPSULATED element) throws IOException {
4294    composeDV_AMOUNTElements(element);
4295    if (element.hasCharset()) {
4296      composeCODE_PHRASE("charset", element.getCharset());
4297    }
4298    if (element.hasLanguage()) {
4299      composeCODE_PHRASE("language", element.getLanguage());
4300    }
4301  }
4302
4303  protected void composeDV_ORDERED(String name, DV_ORDERED element) throws IOException {
4304    if (element != null) {
4305      xml.attribute("xsi:type", element.fhirType());
4306      switch (element.fhirType()) {
4307      case "DV-DATE-TIME":
4308        composeDV_DATE_TIME(name, (DV_DATE_TIME) element);
4309        break;
4310      case "DV-TIME":
4311        composeDV_TIME(name, (DV_TIME) element);
4312        break;
4313      case "DV-INTERVAL":
4314        composeDV_INTERVAL(name, (DV_INTERVAL) element);
4315        break;
4316      case "DV-ORDINAL":
4317        composeDV_ORDINAL(name, (DV_ORDINAL) element);
4318        break;
4319      case "DV-SCALE":
4320        composeDV_SCALE(name, (DV_SCALE) element);
4321        break;
4322      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4323      }
4324    }
4325  }
4326
4327  protected void composeDV_ORDEREDElements(DV_ORDERED element) throws IOException {
4328    composeDATA_VALUEElements(element);
4329    if (element.hasNormal_status()) {
4330      composeCODE_PHRASE("normal_status", element.getNormal_status());
4331    }
4332    if (element.hasNormal_range()) {
4333      composeDV_INTERVAL("normal_range", element.getNormal_range());
4334    }
4335    if (element.hasOther_reference_ranges()) { 
4336      for (REFERENCE_RANGE e : element.getOther_reference_rangesList()) 
4337          composeREFERENCE_RANGE("other_reference_ranges", e); // a
4338    }
4339  }
4340
4341  protected void composeDV_QUANTIFIED(String name, DV_QUANTIFIED element) throws IOException {
4342    if (element != null) {
4343      xml.attribute("xsi:type", element.fhirType());
4344      switch (element.fhirType()) {
4345      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4346      }
4347    }
4348  }
4349
4350  protected void composeDV_QUANTIFIEDElements(DV_QUANTIFIED element) throws IOException {
4351    composeDV_ORDEREDElements(element);
4352    if (element.hasMagnitude_statusElement()) {
4353      composeString("magnitude_status", element.getMagnitude_statusElement());
4354    }
4355    if (element.hasAccuracy()) {
4356      composeBase("accuracy", element.getAccuracy());
4357    }
4358  }
4359
4360  protected void composeDV_TEMPORAL(String name, DV_TEMPORAL element) throws IOException {
4361    if (element != null) {
4362      xml.attribute("xsi:type", element.fhirType());
4363      switch (element.fhirType()) {
4364      case "DV-DATE":
4365        composeDV_DATE(name, (DV_DATE) element);
4366        break;
4367      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4368      }
4369    }
4370  }
4371
4372  protected void composeDV_TEMPORALElements(DV_TEMPORAL element) throws IOException {
4373    composeDV_ABSOLUTE_QUANTITYElements(element);
4374  }
4375
4376  protected void composeDV_TIME_SPECIFICATION(String name, DV_TIME_SPECIFICATION element) throws IOException {
4377    if (element != null) {
4378      xml.attribute("xsi:type", element.fhirType());
4379      switch (element.fhirType()) {
4380      case "DV-GENERAL-TIME-SPECIFICATION":
4381        composeDV_GENERAL_TIME_SPECIFICATION(name, (DV_GENERAL_TIME_SPECIFICATION) element);
4382        break;
4383      case "DV-PERIODIC-TIME-SPECIFICATION":
4384        composeDV_PERIODIC_TIME_SPECIFICATION(name, (DV_PERIODIC_TIME_SPECIFICATION) element);
4385        break;
4386      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4387      }
4388    }
4389  }
4390
4391  protected void composeDV_TIME_SPECIFICATIONElements(DV_TIME_SPECIFICATION element) throws IOException {
4392    composeDATA_VALUEElements(element);
4393    if (element.hasDV_PARSABLEElement()) {
4394      composeString("DV_PARSABLE", element.getDV_PARSABLEElement());
4395    }
4396  }
4397
4398  protected void composeENTRY(String name, ENTRY element) throws IOException {
4399    if (element != null) {
4400      xml.attribute("xsi:type", element.fhirType());
4401      switch (element.fhirType()) {
4402      case "ADMIN-ENTRY":
4403        composeADMIN_ENTRY(name, (ADMIN_ENTRY) element);
4404        break;
4405      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4406      }
4407    }
4408  }
4409
4410  protected void composeENTRYElements(ENTRY element) throws IOException {
4411    composeCONTENT_ITEMElements(element);
4412    if (element.hasLanguage()) {
4413      composeCODE_PHRASE("language", element.getLanguage());
4414    }
4415    if (element.hasEncoding()) {
4416      composeCODE_PHRASE("encoding", element.getEncoding());
4417    }
4418    if (element.hasOther_participations()) { 
4419      for (PARTICIPATION e : element.getOther_participationsList()) 
4420          composePARTICIPATION("other_participations", e); // a
4421    }
4422    if (element.hasWorkflow_id()) {
4423      composeOBJECT_REF("workflow_id", element.getWorkflow_id());
4424    }
4425    if (element.hasSubject()) {
4426      composePARTY_PROXY("subject", element.getSubject());
4427    }
4428    if (element.hasProvider()) {
4429      composePARTY_PROXY("provider", element.getProvider());
4430    }
4431  }
4432
4433  protected void composeEVENT(String name, EVENT element) throws IOException {
4434    if (element != null) {
4435      xml.attribute("xsi:type", element.fhirType());
4436      switch (element.fhirType()) {
4437      case "INTERVAL-EVENT":
4438        composeINTERVAL_EVENT(name, (INTERVAL_EVENT) element);
4439        break;
4440      case "POINT-EVENT":
4441        composePOINT_EVENT(name, (POINT_EVENT) element);
4442        break;
4443      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4444      }
4445    }
4446  }
4447
4448  protected void composeEVENTElements(EVENT element) throws IOException {
4449    composeLOCATABLEElements(element);
4450    if (element.hasTime()) {
4451      composeDV_DATE_TIME("time", element.getTime());
4452    }
4453    if (element.hasState()) {
4454      composeITEM_STRUCTURE("state", element.getState());
4455    }
4456    if (element.hasData()) {
4457      composeAny("data", element.getData());
4458    }
4459  }
4460
4461  protected void composeITEM_STRUCTURE(String name, ITEM_STRUCTURE element) throws IOException {
4462    if (element != null) {
4463      xml.attribute("xsi:type", element.fhirType());
4464      switch (element.fhirType()) {
4465      case "ITEM-SINGLE":
4466        composeITEM_SINGLE(name, (ITEM_SINGLE) element);
4467        break;
4468      case "ITEM-TREE":
4469        composeITEM_TREE(name, (ITEM_TREE) element);
4470        break;
4471      case "ITEM-TABLE":
4472        composeITEM_TABLE(name, (ITEM_TABLE) element);
4473        break;
4474      case "ITEM-LIST":
4475        composeITEM_LIST(name, (ITEM_LIST) element);
4476        break;
4477      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4478      }
4479    }
4480  }
4481
4482  protected void composeITEM_STRUCTUREElements(ITEM_STRUCTURE element) throws IOException {
4483    composeDATA_STRUCTUREElements(element);
4484  }
4485
4486  protected void composeITEM(String name, ITEM element) throws IOException {
4487    if (element != null) {
4488      xml.attribute("xsi:type", element.fhirType());
4489      switch (element.fhirType()) {
4490      case "ELEMENT":
4491        composeELEMENT(name, (ELEMENT) element);
4492        break;
4493      case "CLUSTER":
4494        composeCLUSTER(name, (CLUSTER) element);
4495        break;
4496      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4497      }
4498    }
4499  }
4500
4501  protected void composeITEMElements(ITEM element) throws IOException {
4502    composeLOCATABLEElements(element);
4503  }
4504
4505  protected void composeLOCATABLE(String name, LOCATABLE element) throws IOException {
4506    if (element != null) {
4507      xml.attribute("xsi:type", element.fhirType());
4508      switch (element.fhirType()) {
4509      case "CONTACT":
4510        composeCONTACT(name, (CONTACT) element);
4511        break;
4512      case "EVENT-CONTEXT":
4513        composeEVENT_CONTEXT(name, (EVENT_CONTEXT) element);
4514        break;
4515      case "EHR-STATUS":
4516        composeEHR_STATUS(name, (EHR_STATUS) element);
4517        break;
4518      case "PARTY-IDENTITY":
4519        composePARTY_IDENTITY(name, (PARTY_IDENTITY) element);
4520        break;
4521      case "ADDRESS":
4522        composeADDRESS(name, (ADDRESS) element);
4523        break;
4524      case "COMPOSITION":
4525        composeCOMPOSITION(name, (COMPOSITION) element);
4526        break;
4527      case "PARTY-RELATIONSHIP":
4528        composePARTY_RELATIONSHIP(name, (PARTY_RELATIONSHIP) element);
4529        break;
4530      case "CAPABILITY":
4531        composeCAPABILITY(name, (CAPABILITY) element);
4532        break;
4533      case "EHR-ACCESS":
4534        composeEHR_ACCESS(name, (EHR_ACCESS) element);
4535        break;
4536      case "ACTIVITY":
4537        composeACTIVITY(name, (ACTIVITY) element);
4538        break;
4539      case "FOLDER":
4540        composeFOLDER(name, (FOLDER) element);
4541        break;
4542      case "PARTICIPATION":
4543        composePARTICIPATION(name, (PARTICIPATION) element);
4544        break;
4545      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4546      }
4547    }
4548  }
4549
4550  protected void composeLOCATABLEElements(LOCATABLE element) throws IOException {
4551    composePATHABLEElements(element);
4552  }
4553
4554  protected void composeOBJECT_ID(String name, OBJECT_ID element) throws IOException {
4555    if (element != null) {
4556      xml.attribute("xsi:type", element.fhirType());
4557      switch (element.fhirType()) {
4558      case "TEMPLATE-ID":
4559        composeTEMPLATE_ID(name, (TEMPLATE_ID) element);
4560        break;
4561      case "ARCHETYPE-ID":
4562        composeARCHETYPE_ID(name, (ARCHETYPE_ID) element);
4563        break;
4564      case "GENERIC-ID":
4565        composeGENERIC_ID(name, (GENERIC_ID) element);
4566        break;
4567      case "TERMINOLOGY-ID":
4568        composeTERMINOLOGY_ID(name, (TERMINOLOGY_ID) element);
4569        break;
4570      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4571      }
4572    }
4573  }
4574
4575  protected void composeOBJECT_IDElements(OBJECT_ID element) throws IOException {
4576    composeUIDElements(element);
4577  }
4578
4579  protected void composePARTY_PROXY(String name, PARTY_PROXY element) throws IOException {
4580    if (element != null) {
4581      xml.attribute("xsi:type", element.fhirType());
4582      switch (element.fhirType()) {
4583      case "PARTY-SELF":
4584        composePARTY_SELF(name, (PARTY_SELF) element);
4585        break;
4586      case "PARTY-IDENTIFIED":
4587        composePARTY_IDENTIFIED(name, (PARTY_IDENTIFIED) element);
4588        break;
4589      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4590      }
4591    }
4592  }
4593
4594  protected void composePARTY_PROXYElements(PARTY_PROXY element) throws IOException {
4595    composeBaseElements(element);
4596    if (element.hasExternal_ref()) {
4597      composePARTY_REF("external_ref", element.getExternal_ref());
4598    }
4599  }
4600
4601  protected void composePARTY(String name, PARTY element) throws IOException {
4602    if (element != null) {
4603      xml.attribute("xsi:type", element.fhirType());
4604      switch (element.fhirType()) {
4605      case "ROLE":
4606        composeROLE(name, (ROLE) element);
4607        break;
4608      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4609      }
4610    }
4611  }
4612
4613  protected void composePARTYElements(PARTY element) throws IOException {
4614    composeLOCATABLEElements(element);
4615    if (element.hasIdentities()) { 
4616      for (PARTY_IDENTITY e : element.getIdentitiesList()) 
4617          composePARTY_IDENTITY("identities", e); // a
4618    }
4619    if (element.hasContacts()) {
4620      composeCONTACT("contacts", element.getContacts());
4621    }
4622    if (element.hasDetails()) {
4623      composeITEM_STRUCTURE("details", element.getDetails());
4624    }
4625    if (element.hasReverse_relationships()) { 
4626      for (LOCATABLE_REF e : element.getReverse_relationshipsList()) 
4627          composeLOCATABLE_REF("reverse_relationships", e); // a
4628    }
4629    if (element.hasRelationships()) { 
4630      for (PARTY_RELATIONSHIP e : element.getRelationshipsList()) 
4631          composePARTY_RELATIONSHIP("relationships", e); // a
4632    }
4633  }
4634
4635  protected void composePATHABLE(String name, PATHABLE element) throws IOException {
4636    if (element != null) {
4637      xml.attribute("xsi:type", element.fhirType());
4638      switch (element.fhirType()) {
4639      case "INSTRUCTION-DETAILS":
4640        composeINSTRUCTION_DETAILS(name, (INSTRUCTION_DETAILS) element);
4641        break;
4642      case "ISM-TRANSITION":
4643        composeISM_TRANSITION(name, (ISM_TRANSITION) element);
4644        break;
4645      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4646      }
4647    }
4648  }
4649
4650  protected void composePATHABLEElements(PATHABLE element) throws IOException {
4651    composeAnyElements(element);
4652    if (element.hasName()) {
4653      composeDV_TEXT("name", element.getName());
4654    }
4655    if (element.hasArchetype_node_idElement()) {
4656      composeString("archetype_node_id", element.getArchetype_node_idElement());
4657    }
4658    if (element.hasUid()) {
4659      composeUID_BASED_ID("uid", element.getUid());
4660    }
4661    if (element.hasLinks()) { 
4662      for (LINK e : element.getLinksList()) 
4663          composeLINK("links", e); // a
4664    }
4665    if (element.hasArchetype_details()) {
4666      composeARCHETYPED("archetype_details", element.getArchetype_details());
4667    }
4668    if (element.hasFeeder_audit()) {
4669      composeFEEDER_AUDIT("feeder_audit", element.getFeeder_audit());
4670    }
4671  }
4672
4673  protected void composeUID_BASED_ID(String name, UID_BASED_ID element) throws IOException {
4674    if (element != null) {
4675      xml.attribute("xsi:type", element.fhirType());
4676      switch (element.fhirType()) {
4677      case "OBJECT-VERSION-ID":
4678        composeOBJECT_VERSION_ID(name, (OBJECT_VERSION_ID) element);
4679        break;
4680      case "HIER-OBJECT-ID":
4681        composeHIER_OBJECT_ID(name, (HIER_OBJECT_ID) element);
4682        break;
4683      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4684      }
4685    }
4686  }
4687
4688  protected void composeUID_BASED_IDElements(UID_BASED_ID element) throws IOException {
4689    composeOBJECT_IDElements(element);
4690  }
4691
4692  protected void composeUID(String name, UID element) throws IOException {
4693    if (element != null) {
4694      xml.attribute("xsi:type", element.fhirType());
4695      switch (element.fhirType()) {
4696      case "ISO-OID":
4697        composeISO_OID(name, (ISO_OID) element);
4698        break;
4699      case "UUID":
4700        composeUUID(name, (UUID) element);
4701        break;
4702      case "INTERNET-ID":
4703        composeINTERNET_ID(name, (INTERNET_ID) element);
4704        break;
4705      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4706      }
4707    }
4708  }
4709
4710  protected void composeUIDElements(UID element) throws IOException {
4711    composeBaseElements(element);
4712    if (element.hasValueElement()) {
4713      composeString("value", element.getValueElement());
4714    }
4715  }
4716
4717  protected void composeVERSION(String name, VERSION element) throws IOException {
4718    if (element != null) {
4719      xml.attribute("xsi:type", element.fhirType());
4720      switch (element.fhirType()) {
4721      case "IMPORTED-VERSION":
4722        composeIMPORTED_VERSION(name, (IMPORTED_VERSION) element);
4723        break;
4724      case "ORIGINAL-VERSION":
4725        composeORIGINAL_VERSION(name, (ORIGINAL_VERSION) element);
4726        break;
4727      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
4728      }
4729    }
4730  }
4731
4732  protected void composeVERSIONElements(VERSION element) throws IOException {
4733    composeBaseElements(element);
4734    if (element.hasContribution()) {
4735      composeOBJECT_REF("contribution", element.getContribution());
4736    }
4737    if (element.hasSignatureElement()) {
4738      composeString("signature", element.getSignatureElement());
4739    }
4740    if (element.hasCommit_audit()) {
4741      composeAUDIT_DETAILS("commit_audit", element.getCommit_audit());
4742    }
4743  }
4744
4745  protected void composeACTION(String name, ACTION element) throws IOException {
4746    if (element != null) {
4747      xml.enter(FHIR_NS, name);
4748      composeACTIONElements(element);
4749      composeElementClose(element);
4750      xml.exit(FHIR_NS, name);
4751    }
4752  }
4753
4754  protected void composeACTIONElements(ACTION element) throws IOException {
4755    composeCARE_ENTRYElements(element);
4756    if (element.hasTime()) {
4757      composeDV_DATE_TIME("time", element.getTime());
4758    }
4759    if (element.hasIsm_transition()) {
4760      composeISM_TRANSITION("ism_transition", element.getIsm_transition());
4761    }
4762    if (element.hasInstruction_details()) {
4763      composeINSTRUCTION_DETAILS("instruction_details", element.getInstruction_details());
4764    }
4765    if (element.hasDescription()) {
4766      composeITEM_STRUCTURE("description", element.getDescription());
4767    }
4768  }
4769
4770  protected void composeACTIVITY(String name, ACTIVITY element) throws IOException {
4771    if (element != null) {
4772      xml.enter(FHIR_NS, name);
4773      composeACTIVITYElements(element);
4774      composeElementClose(element);
4775      xml.exit(FHIR_NS, name);
4776    }
4777  }
4778
4779  protected void composeACTIVITYElements(ACTIVITY element) throws IOException {
4780    composeLOCATABLEElements(element);
4781    if (element.hasTiming()) {
4782      composeDV_PARSABLE("timing", element.getTiming());
4783    }
4784    if (element.hasAction_archetype_idElement()) {
4785      composeString("action_archetype_id", element.getAction_archetype_idElement());
4786    }
4787    if (element.hasDescription()) {
4788      composeITEM_STRUCTURE("description", element.getDescription());
4789    }
4790  }
4791
4792  protected void composeADDRESS(String name, ADDRESS element) throws IOException {
4793    if (element != null) {
4794      xml.enter(FHIR_NS, name);
4795      composeADDRESSElements(element);
4796      composeElementClose(element);
4797      xml.exit(FHIR_NS, name);
4798    }
4799  }
4800
4801  protected void composeADDRESSElements(ADDRESS element) throws IOException {
4802    composeLOCATABLEElements(element);
4803    if (element.hasDetails()) {
4804      composeITEM_STRUCTURE("details", element.getDetails());
4805    }
4806  }
4807
4808  protected void composeADMIN_ENTRY(String name, ADMIN_ENTRY element) throws IOException {
4809    if (element != null) {
4810      xml.enter(FHIR_NS, name);
4811      composeADMIN_ENTRYElements(element);
4812      composeElementClose(element);
4813      xml.exit(FHIR_NS, name);
4814    }
4815  }
4816
4817  protected void composeADMIN_ENTRYElements(ADMIN_ENTRY element) throws IOException {
4818    composeENTRYElements(element);
4819    if (element.hasData()) {
4820      composeITEM_STRUCTURE("data", element.getData());
4821    }
4822  }
4823
4824  protected void composeAGENT(String name, AGENT element) throws IOException {
4825    if (element != null) {
4826      xml.enter(FHIR_NS, name);
4827      composeAGENTElements(element);
4828      composeElementClose(element);
4829      xml.exit(FHIR_NS, name);
4830    }
4831  }
4832
4833  protected void composeAGENTElements(AGENT element) throws IOException {
4834    composeACTORElements(element);
4835  }
4836
4837  protected void composeARCHETYPE_ID(String name, ARCHETYPE_ID element) throws IOException {
4838    if (element != null) {
4839      xml.enter(FHIR_NS, name);
4840      composeARCHETYPE_IDElements(element);
4841      composeElementClose(element);
4842      xml.exit(FHIR_NS, name);
4843    }
4844  }
4845
4846  protected void composeARCHETYPE_IDElements(ARCHETYPE_ID element) throws IOException {
4847    composeOBJECT_IDElements(element);
4848  }
4849
4850  protected void composeARCHETYPED(String name, ARCHETYPED element) throws IOException {
4851    if (element != null) {
4852      xml.enter(FHIR_NS, name);
4853      composeARCHETYPEDElements(element);
4854      composeElementClose(element);
4855      xml.exit(FHIR_NS, name);
4856    }
4857  }
4858
4859  protected void composeARCHETYPEDElements(ARCHETYPED element) throws IOException {
4860    composeBaseElements(element);
4861    if (element.hasArchetype_id()) {
4862      composeARCHETYPE_ID("archetype_id", element.getArchetype_id());
4863    }
4864    if (element.hasTemplate_id()) {
4865      composeTEMPLATE_ID("template_id", element.getTemplate_id());
4866    }
4867    if (element.hasRm_versionElement()) {
4868      composeString("rm_version", element.getRm_versionElement());
4869    }
4870  }
4871
4872  protected void composeATTESTATION(String name, ATTESTATION element) throws IOException {
4873    if (element != null) {
4874      xml.enter(FHIR_NS, name);
4875      composeATTESTATIONElements(element);
4876      composeElementClose(element);
4877      xml.exit(FHIR_NS, name);
4878    }
4879  }
4880
4881  protected void composeATTESTATIONElements(ATTESTATION element) throws IOException {
4882    composeAUDIT_DETAILSElements(element);
4883    if (element.hasAttested_view()) {
4884      composeDV_MULTIMEDIA("attested_view", element.getAttested_view());
4885    }
4886    if (element.hasProofElement()) {
4887      composeString("proof", element.getProofElement());
4888    }
4889    if (element.hasItems()) { 
4890      for (DV_EHR_URI e : element.getItemsList()) 
4891          composeDV_EHR_URI("items", e); // a
4892    }
4893    if (element.hasReason()) {
4894      composeDV_TEXT("reason", element.getReason());
4895    }
4896    if (element.hasIs_pendingElement()) {
4897      composeBoolean("is_pending", element.getIs_pendingElement());
4898    }
4899  }
4900
4901  protected void composeAUDIT_DETAILS(String name, AUDIT_DETAILS element) throws IOException {
4902    if (element != null) {
4903      xml.enter(FHIR_NS, name);
4904      composeAUDIT_DETAILSElements(element);
4905      composeElementClose(element);
4906      xml.exit(FHIR_NS, name);
4907    }
4908  }
4909
4910  protected void composeAUDIT_DETAILSElements(AUDIT_DETAILS element) throws IOException {
4911    composeBaseElements(element);
4912    if (element.hasSystem_idElement()) {
4913      composeString("system_id", element.getSystem_idElement());
4914    }
4915    if (element.hasTime_committed()) {
4916      composeDV_DATE_TIME("time_committed", element.getTime_committed());
4917    }
4918    if (element.hasChange_type()) {
4919      composeDV_CODED_TEXT("change_type", element.getChange_type());
4920    }
4921    if (element.hasDescription()) {
4922      composeDV_TEXT("description", element.getDescription());
4923    }
4924    if (element.hasCommitter()) {
4925      composePARTY_PROXY("committer", element.getCommitter());
4926    }
4927  }
4928
4929  protected void composeAnnotations(String name, Annotations element) throws IOException {
4930    if (element != null) {
4931      xml.enter(FHIR_NS, name);
4932      composeAnnotationsElements(element);
4933      composeElementClose(element);
4934      xml.exit(FHIR_NS, name);
4935    }
4936  }
4937
4938  protected void composeAnnotationsElements(Annotations element) throws IOException {
4939    composeBaseElements(element);
4940    if (element.hasCommentElement()) {
4941      composeString("comment", element.getCommentElement());
4942    }
4943    if (element.hasFhir_mappingElement()) {
4944      composeString("fhir_mapping", element.getFhir_mappingElement());
4945    }
4946    if (element.hasVset_descriptionElement()) {
4947      composeString("vset_description", element.getVset_descriptionElement());
4948    }
4949    if (element.hasHl7v2_mappingElement()) {
4950      composeString("hl7v2_mapping", element.getHl7v2_mappingElement());
4951    }
4952    if (element.hasVisibleInViewElement()) {
4953      composeString("visibleInView", element.getVisibleInViewElement());
4954    }
4955  }
4956
4957  protected void composeCAPABILITY(String name, CAPABILITY element) throws IOException {
4958    if (element != null) {
4959      xml.enter(FHIR_NS, name);
4960      composeCAPABILITYElements(element);
4961      composeElementClose(element);
4962      xml.exit(FHIR_NS, name);
4963    }
4964  }
4965
4966  protected void composeCAPABILITYElements(CAPABILITY element) throws IOException {
4967    composeLOCATABLEElements(element);
4968    if (element.hasCredentials()) {
4969      composeITEM_STRUCTURE("credentials", element.getCredentials());
4970    }
4971    if (element.hasTime_validity()) {
4972      composeDV_INTERVAL("time_validity", element.getTime_validity());
4973    }
4974  }
4975
4976  protected void composeCLUSTER(String name, CLUSTER element) throws IOException {
4977    if (element != null) {
4978      xml.enter(FHIR_NS, name);
4979      composeCLUSTERElements(element);
4980      composeElementClose(element);
4981      xml.exit(FHIR_NS, name);
4982    }
4983  }
4984
4985  protected void composeCLUSTERElements(CLUSTER element) throws IOException {
4986    composeITEMElements(element);
4987    if (element.hasItems()) { 
4988      for (ITEM e : element.getItemsList()) 
4989          composeITEM("items", e); // a
4990    }
4991  }
4992
4993  protected void composeCODE_PHRASE(String name, CODE_PHRASE element) throws IOException {
4994    if (element != null) {
4995      xml.enter(FHIR_NS, name);
4996      composeCODE_PHRASEElements(element);
4997      composeElementClose(element);
4998      xml.exit(FHIR_NS, name);
4999    }
5000  }
5001
5002  protected void composeCODE_PHRASEElements(CODE_PHRASE element) throws IOException {
5003    composeBaseElements(element);
5004    if (element.hasTerminology_id()) {
5005      composeTERMINOLOGY_ID("terminology_id", element.getTerminology_id());
5006    }
5007    if (element.hasCode_stringElement()) {
5008      composeString("code_string", element.getCode_stringElement());
5009    }
5010    if (element.hasPreferred_termElement()) {
5011      composeString("preferred_term", element.getPreferred_termElement());
5012    }
5013  }
5014
5015  protected void composeCOMPOSITION(String name, COMPOSITION element) throws IOException {
5016    if (element != null) {
5017      xml.enter(FHIR_NS, name);
5018      composeCOMPOSITIONElements(element);
5019      composeElementClose(element);
5020      xml.exit(FHIR_NS, name);
5021    }
5022  }
5023
5024  protected void composeCOMPOSITIONElements(COMPOSITION element) throws IOException {
5025    composeLOCATABLEElements(element);
5026    if (element.hasLanguage()) {
5027      composeCODE_PHRASE("language", element.getLanguage());
5028    }
5029    if (element.hasTerritory()) {
5030      composeCODE_PHRASE("territory", element.getTerritory());
5031    }
5032    if (element.hasCategory()) {
5033      composeDV_CODED_TEXT("category", element.getCategory());
5034    }
5035    if (element.hasContext()) {
5036      composeEVENT_CONTEXT("context", element.getContext());
5037    }
5038    if (element.hasComposer()) {
5039      composePARTY_PROXY("composer", element.getComposer());
5040    }
5041    if (element.hasContent()) { 
5042      for (CONTENT_ITEM e : element.getContentList()) 
5043          composeCONTENT_ITEM("content", e); // a
5044    }
5045  }
5046
5047  protected void composeCONTACT(String name, CONTACT element) throws IOException {
5048    if (element != null) {
5049      xml.enter(FHIR_NS, name);
5050      composeCONTACTElements(element);
5051      composeElementClose(element);
5052      xml.exit(FHIR_NS, name);
5053    }
5054  }
5055
5056  protected void composeCONTACTElements(CONTACT element) throws IOException {
5057    composeLOCATABLEElements(element);
5058    if (element.hasAddresses()) { 
5059      for (ADDRESS e : element.getAddressesList()) 
5060          composeADDRESS("addresses", e); // a
5061    }
5062    if (element.hasTime_validity()) {
5063      composeDV_INTERVAL("time_validity", element.getTime_validity());
5064    }
5065  }
5066
5067  protected void composeCONTRIBUTION(String name, CONTRIBUTION element) throws IOException {
5068    if (element != null) {
5069      xml.enter(FHIR_NS, name);
5070      composeCONTRIBUTIONElements(element);
5071      composeElementClose(element);
5072      xml.exit(FHIR_NS, name);
5073    }
5074  }
5075
5076  protected void composeCONTRIBUTIONElements(CONTRIBUTION element) throws IOException {
5077    composeBaseElements(element);
5078    if (element.hasUid()) {
5079      composeHIER_OBJECT_ID("uid", element.getUid());
5080    }
5081    if (element.hasVersions()) { 
5082      for (OBJECT_REF e : element.getVersionsList()) 
5083          composeOBJECT_REF("versions", e); // a
5084    }
5085    if (element.hasAudit()) {
5086      composeAUDIT_DETAILS("audit", element.getAudit());
5087    }
5088  }
5089
5090  protected void composeDV_BOOLEAN(String name, DV_BOOLEAN element) throws IOException {
5091    if (element != null) {
5092      xml.enter(FHIR_NS, name);
5093      composeDV_BOOLEANElements(element);
5094      composeElementClose(element);
5095      xml.exit(FHIR_NS, name);
5096    }
5097  }
5098
5099  protected void composeDV_BOOLEANElements(DV_BOOLEAN element) throws IOException {
5100    composeDATA_VALUEElements(element);
5101    if (element.hasValueElement()) {
5102      composeBoolean("value", element.getValueElement());
5103    }
5104  }
5105
5106  protected void composeDV_CODED_TEXT(String name, DV_CODED_TEXT element) throws IOException {
5107    if (element != null) {
5108      xml.enter(FHIR_NS, name);
5109      composeDV_CODED_TEXTElements(element);
5110      composeElementClose(element);
5111      xml.exit(FHIR_NS, name);
5112    }
5113  }
5114
5115  protected void composeDV_CODED_TEXTElements(DV_CODED_TEXT element) throws IOException {
5116    composeDV_TEXTElements(element);
5117    if (element.hasDefining_code()) {
5118      composeCODE_PHRASE("defining_code", element.getDefining_code());
5119    }
5120  }
5121
5122  protected void composeDV_COUNT(String name, DV_COUNT element) throws IOException {
5123    if (element != null) {
5124      xml.enter(FHIR_NS, name);
5125      composeDV_COUNTElements(element);
5126      composeElementClose(element);
5127      xml.exit(FHIR_NS, name);
5128    }
5129  }
5130
5131  protected void composeDV_COUNTElements(DV_COUNT element) throws IOException {
5132    composeDV_AMOUNTElements(element);
5133    if (element.hasMagnitudeElement()) {
5134      composeDecimal("magnitude", element.getMagnitudeElement());
5135    }
5136  }
5137
5138  protected void composeDV_DATE_TIME(String name, DV_DATE_TIME element) throws IOException {
5139    if (element != null) {
5140      xml.enter(FHIR_NS, name);
5141      composeDV_DATE_TIMEElements(element);
5142      composeElementClose(element);
5143      xml.exit(FHIR_NS, name);
5144    }
5145  }
5146
5147  protected void composeDV_DATE_TIMEElements(DV_DATE_TIME element) throws IOException {
5148    composeDV_ORDEREDElements(element);
5149    if (element.hasValueElement()) {
5150      composeDateTime("value", element.getValueElement());
5151    }
5152  }
5153
5154  protected void composeDV_DATE(String name, DV_DATE element) throws IOException {
5155    if (element != null) {
5156      xml.enter(FHIR_NS, name);
5157      composeDV_DATEElements(element);
5158      composeElementClose(element);
5159      xml.exit(FHIR_NS, name);
5160    }
5161  }
5162
5163  protected void composeDV_DATEElements(DV_DATE element) throws IOException {
5164    composeDV_TEMPORALElements(element);
5165    if (element.hasValueElement()) {
5166      composeDateTime("value", element.getValueElement());
5167    }
5168  }
5169
5170  protected void composeDV_DURATION(String name, DV_DURATION element) throws IOException {
5171    if (element != null) {
5172      xml.enter(FHIR_NS, name);
5173      composeDV_DURATIONElements(element);
5174      composeElementClose(element);
5175      xml.exit(FHIR_NS, name);
5176    }
5177  }
5178
5179  protected void composeDV_DURATIONElements(DV_DURATION element) throws IOException {
5180    composeDV_AMOUNTElements(element);
5181    if (element.hasValueElement()) {
5182      composeString("value", element.getValueElement());
5183    }
5184  }
5185
5186  protected void composeDV_EHR_URI(String name, DV_EHR_URI element) throws IOException {
5187    if (element != null) {
5188      xml.enter(FHIR_NS, name);
5189      composeDV_EHR_URIElements(element);
5190      composeElementClose(element);
5191      xml.exit(FHIR_NS, name);
5192    }
5193  }
5194
5195  protected void composeDV_EHR_URIElements(DV_EHR_URI element) throws IOException {
5196    composeDV_URIElements(element);
5197  }
5198
5199  protected void composeDV_GENERAL_TIME_SPECIFICATION(String name, DV_GENERAL_TIME_SPECIFICATION element) throws IOException {
5200    if (element != null) {
5201      xml.enter(FHIR_NS, name);
5202      composeDV_GENERAL_TIME_SPECIFICATIONElements(element);
5203      composeElementClose(element);
5204      xml.exit(FHIR_NS, name);
5205    }
5206  }
5207
5208  protected void composeDV_GENERAL_TIME_SPECIFICATIONElements(DV_GENERAL_TIME_SPECIFICATION element) throws IOException {
5209    composeDV_TIME_SPECIFICATIONElements(element);
5210  }
5211
5212  protected void composeDV_IDENTIFIER(String name, DV_IDENTIFIER element) throws IOException {
5213    if (element != null) {
5214      xml.enter(FHIR_NS, name);
5215      composeDV_IDENTIFIERElements(element);
5216      composeElementClose(element);
5217      xml.exit(FHIR_NS, name);
5218    }
5219  }
5220
5221  protected void composeDV_IDENTIFIERElements(DV_IDENTIFIER element) throws IOException {
5222    composeDATA_VALUEElements(element);
5223    if (element.hasIssuerElement()) {
5224      composeString("issuer", element.getIssuerElement());
5225    }
5226    if (element.hasAssignerElement()) {
5227      composeString("assigner", element.getAssignerElement());
5228    }
5229    if (element.hasIdElement()) {
5230      composeString("id", element.getIdElement());
5231    }
5232    if (element.hasTypeElement()) {
5233      composeString("type", element.getTypeElement());
5234    }
5235  }
5236
5237  protected void composeDV_INTERVAL(String name, DV_INTERVAL element) throws IOException {
5238    if (element != null) {
5239      xml.enter(FHIR_NS, name);
5240      composeDV_INTERVALElements(element);
5241      composeElementClose(element);
5242      xml.exit(FHIR_NS, name);
5243    }
5244  }
5245
5246  protected void composeDV_INTERVALElements(DV_INTERVAL element) throws IOException {
5247    composeDV_ORDEREDElements(element);
5248  }
5249
5250  protected void composeDV_MULTIMEDIA(String name, DV_MULTIMEDIA element) throws IOException {
5251    if (element != null) {
5252      xml.enter(FHIR_NS, name);
5253      composeDV_MULTIMEDIAElements(element);
5254      composeElementClose(element);
5255      xml.exit(FHIR_NS, name);
5256    }
5257  }
5258
5259  protected void composeDV_MULTIMEDIAElements(DV_MULTIMEDIA element) throws IOException {
5260    composeDV_ENCAPSULATEDElements(element);
5261    if (element.hasAlternate_textElement()) {
5262      composeString("alternate_text", element.getAlternate_textElement());
5263    }
5264    if (element.hasUri()) {
5265      composeDV_URI("uri", element.getUri());
5266    }
5267    if (element.hasDataElement()) {
5268      composeBase64Binary("data", element.getDataElement());
5269    }
5270    if (element.hasMedia_type()) {
5271      composeCODE_PHRASE("media_type", element.getMedia_type());
5272    }
5273    if (element.hasCompression_algorithm()) {
5274      composeCODE_PHRASE("compression_algorithm", element.getCompression_algorithm());
5275    }
5276    if (element.hasIntegrity_checkElement()) {
5277      composeBase64Binary("integrity_check", element.getIntegrity_checkElement());
5278    }
5279    if (element.hasIntegrity_check_algorithm()) {
5280      composeCODE_PHRASE("integrity_check_algorithm", element.getIntegrity_check_algorithm());
5281    }
5282    if (element.hasThumbnail()) {
5283      composeDV_MULTIMEDIA("thumbnail", element.getThumbnail());
5284    }
5285    if (element.hasSizeElement()) {
5286      composeInteger("size", element.getSizeElement());
5287    }
5288  }
5289
5290  protected void composeDV_ORDINAL(String name, DV_ORDINAL element) throws IOException {
5291    if (element != null) {
5292      xml.enter(FHIR_NS, name);
5293      composeDV_ORDINALElements(element);
5294      composeElementClose(element);
5295      xml.exit(FHIR_NS, name);
5296    }
5297  }
5298
5299  protected void composeDV_ORDINALElements(DV_ORDINAL element) throws IOException {
5300    composeDV_ORDEREDElements(element);
5301    if (element.hasSymbol()) {
5302      composeDV_CODED_TEXT("symbol", element.getSymbol());
5303    }
5304    if (element.hasValueElement()) {
5305      composeInteger("value", element.getValueElement());
5306    }
5307  }
5308
5309  protected void composeDV_PARAGRAPH(String name, DV_PARAGRAPH element) throws IOException {
5310    if (element != null) {
5311      xml.enter(FHIR_NS, name);
5312      composeDV_PARAGRAPHElements(element);
5313      composeElementClose(element);
5314      xml.exit(FHIR_NS, name);
5315    }
5316  }
5317
5318  protected void composeDV_PARAGRAPHElements(DV_PARAGRAPH element) throws IOException {
5319    composeDATA_VALUEElements(element);
5320    if (element.hasItems()) { 
5321      for (DV_TEXT e : element.getItemsList()) 
5322          composeDV_TEXT("items", e); // a
5323    }
5324  }
5325
5326  protected void composeDV_PARSABLE(String name, DV_PARSABLE element) throws IOException {
5327    if (element != null) {
5328      xml.enter(FHIR_NS, name);
5329      composeDV_PARSABLEElements(element);
5330      composeElementClose(element);
5331      xml.exit(FHIR_NS, name);
5332    }
5333  }
5334
5335  protected void composeDV_PARSABLEElements(DV_PARSABLE element) throws IOException {
5336    composeDV_ENCAPSULATEDElements(element);
5337    if (element.hasValueElement()) {
5338      composeString("value", element.getValueElement());
5339    }
5340    if (element.hasFormalismElement()) {
5341      composeString("formalism", element.getFormalismElement());
5342    }
5343  }
5344
5345  protected void composeDV_PERIODIC_TIME_SPECIFICATION(String name, DV_PERIODIC_TIME_SPECIFICATION element) throws IOException {
5346    if (element != null) {
5347      xml.enter(FHIR_NS, name);
5348      composeDV_PERIODIC_TIME_SPECIFICATIONElements(element);
5349      composeElementClose(element);
5350      xml.exit(FHIR_NS, name);
5351    }
5352  }
5353
5354  protected void composeDV_PERIODIC_TIME_SPECIFICATIONElements(DV_PERIODIC_TIME_SPECIFICATION element) throws IOException {
5355    composeDV_TIME_SPECIFICATIONElements(element);
5356  }
5357
5358  protected void composeDV_PROPORTION(String name, DV_PROPORTION element) throws IOException {
5359    if (element != null) {
5360      xml.enter(FHIR_NS, name);
5361      composeDV_PROPORTIONElements(element);
5362      composeElementClose(element);
5363      xml.exit(FHIR_NS, name);
5364    }
5365  }
5366
5367  protected void composeDV_PROPORTIONElements(DV_PROPORTION element) throws IOException {
5368    composeDV_AMOUNTElements(element);
5369    if (element.hasNumeratorElement()) {
5370      composeDecimal("numerator", element.getNumeratorElement());
5371    }
5372    if (element.hasDenominatorElement()) {
5373      composeDecimal("denominator", element.getDenominatorElement());
5374    }
5375    if (element.hasTypeElement()) {
5376      composeCode("type", element.getTypeElement());
5377    }
5378    if (element.hasPrecisionElement()) {
5379      composeInteger("precision", element.getPrecisionElement());
5380    }
5381  }
5382
5383  protected void composeDV_QUANTITY(String name, DV_QUANTITY element) throws IOException {
5384    if (element != null) {
5385      xml.enter(FHIR_NS, name);
5386      composeDV_QUANTITYElements(element);
5387      composeElementClose(element);
5388      xml.exit(FHIR_NS, name);
5389    }
5390  }
5391
5392  protected void composeDV_QUANTITYElements(DV_QUANTITY element) throws IOException {
5393    composeDV_AMOUNTElements(element);
5394    if (element.hasMagnitudeElement()) {
5395      composeDecimal("magnitude", element.getMagnitudeElement());
5396    }
5397    if (element.hasPrecisionElement()) {
5398      composeInteger("precision", element.getPrecisionElement());
5399    }
5400    if (element.hasUnitsElement()) {
5401      composeString("units", element.getUnitsElement());
5402    }
5403    if (element.hasUnits_systemElement()) {
5404      composeString("units_system", element.getUnits_systemElement());
5405    }
5406    if (element.hasUnits_display_nameElement()) {
5407      composeString("units_display_name", element.getUnits_display_nameElement());
5408    }
5409  }
5410
5411  protected void composeDV_SCALE(String name, DV_SCALE element) throws IOException {
5412    if (element != null) {
5413      xml.enter(FHIR_NS, name);
5414      composeDV_SCALEElements(element);
5415      composeElementClose(element);
5416      xml.exit(FHIR_NS, name);
5417    }
5418  }
5419
5420  protected void composeDV_SCALEElements(DV_SCALE element) throws IOException {
5421    composeDV_ORDEREDElements(element);
5422    if (element.hasSymbol()) {
5423      composeDV_CODED_TEXT("symbol", element.getSymbol());
5424    }
5425    if (element.hasValueElement()) {
5426      composeDecimal("value", element.getValueElement());
5427    }
5428  }
5429
5430  protected void composeDV_STATE(String name, DV_STATE element) throws IOException {
5431    if (element != null) {
5432      xml.enter(FHIR_NS, name);
5433      composeDV_STATEElements(element);
5434      composeElementClose(element);
5435      xml.exit(FHIR_NS, name);
5436    }
5437  }
5438
5439  protected void composeDV_STATEElements(DV_STATE element) throws IOException {
5440    composeDATA_VALUEElements(element);
5441    if (element.hasValue()) {
5442      composeDV_CODED_TEXT("value", element.getValue());
5443    }
5444    if (element.hasIs_terminalElement()) {
5445      composeBoolean("is_terminal", element.getIs_terminalElement());
5446    }
5447  }
5448
5449  protected void composeDV_TEXT(String name, DV_TEXT element) throws IOException {
5450    if (element != null) {
5451      xml.enter(FHIR_NS, name);
5452      composeDV_TEXTElements(element);
5453      composeElementClose(element);
5454      xml.exit(FHIR_NS, name);
5455    }
5456  }
5457
5458  protected void composeDV_TEXTElements(DV_TEXT element) throws IOException {
5459    composeDATA_VALUEElements(element);
5460    if (element.hasValueElement()) {
5461      composeString("value", element.getValueElement());
5462    }
5463    if (element.hasHyperlink()) {
5464      composeDV_URI("hyperlink", element.getHyperlink());
5465    }
5466    if (element.hasFormattingElement()) {
5467      composeString("formatting", element.getFormattingElement());
5468    }
5469    if (element.hasMappings()) { 
5470      for (TERM_MAPPING e : element.getMappingsList()) 
5471          composeTERM_MAPPING("mappings", e); // a
5472    }
5473    if (element.hasLanguage()) {
5474      composeCODE_PHRASE("language", element.getLanguage());
5475    }
5476    if (element.hasEncoding()) {
5477      composeCODE_PHRASE("encoding", element.getEncoding());
5478    }
5479  }
5480
5481  protected void composeDV_TIME(String name, DV_TIME element) throws IOException {
5482    if (element != null) {
5483      xml.enter(FHIR_NS, name);
5484      composeDV_TIMEElements(element);
5485      composeElementClose(element);
5486      xml.exit(FHIR_NS, name);
5487    }
5488  }
5489
5490  protected void composeDV_TIMEElements(DV_TIME element) throws IOException {
5491    composeDV_ORDEREDElements(element);
5492    if (element.hasValueElement()) {
5493      composeString("value", element.getValueElement());
5494    }
5495  }
5496
5497  protected void composeDV_URI(String name, DV_URI element) throws IOException {
5498    if (element != null) {
5499      xml.enter(FHIR_NS, name);
5500      composeDV_URIElements(element);
5501      composeElementClose(element);
5502      xml.exit(FHIR_NS, name);
5503    }
5504  }
5505
5506  protected void composeDV_URIElements(DV_URI element) throws IOException {
5507    composeDATA_VALUEElements(element);
5508    if (element.hasValueElement()) {
5509      composeUri("value", element.getValueElement());
5510    }
5511  }
5512
5513  protected void composeEHR_ACCESS(String name, EHR_ACCESS element) throws IOException {
5514    if (element != null) {
5515      xml.enter(FHIR_NS, name);
5516      composeEHR_ACCESSElements(element);
5517      composeElementClose(element);
5518      xml.exit(FHIR_NS, name);
5519    }
5520  }
5521
5522  protected void composeEHR_ACCESSElements(EHR_ACCESS element) throws IOException {
5523    composeLOCATABLEElements(element);
5524    if (element.hasSettings()) {
5525      composeACCESS_CONTROL_SETTINGS("settings", element.getSettings());
5526    }
5527  }
5528
5529  protected void composeEHR_STATUS(String name, EHR_STATUS element) throws IOException {
5530    if (element != null) {
5531      xml.enter(FHIR_NS, name);
5532      composeEHR_STATUSElements(element);
5533      composeElementClose(element);
5534      xml.exit(FHIR_NS, name);
5535    }
5536  }
5537
5538  protected void composeEHR_STATUSElements(EHR_STATUS element) throws IOException {
5539    composeLOCATABLEElements(element);
5540    if (element.hasSubject()) {
5541      composePARTY_SELF("subject", element.getSubject());
5542    }
5543    if (element.hasIs_queryableElement()) {
5544      composeBoolean("is_queryable", element.getIs_queryableElement());
5545    }
5546    if (element.hasIs_modifiableElement()) {
5547      composeBoolean("is_modifiable", element.getIs_modifiableElement());
5548    }
5549    if (element.hasOther_details()) {
5550      composeITEM_STRUCTURE("other_details", element.getOther_details());
5551    }
5552  }
5553
5554  protected void composeEHR(String name, EHR element) throws IOException {
5555    if (element != null) {
5556      xml.enter(FHIR_NS, name);
5557      composeEHRElements(element);
5558      composeElementClose(element);
5559      xml.exit(FHIR_NS, name);
5560    }
5561  }
5562
5563  protected void composeEHRElements(EHR element) throws IOException {
5564    composeAnyElements(element);
5565    if (element.hasSystem_id()) { 
5566      for (HIER_OBJECT_ID e : element.getSystem_idList()) 
5567          composeHIER_OBJECT_ID("system_id", e); // a
5568    }
5569    if (element.hasEhr_id()) {
5570      composeHIER_OBJECT_ID("ehr_id", element.getEhr_id());
5571    }
5572    if (element.hasContributions()) { 
5573      for (OBJECT_REF e : element.getContributionsList()) 
5574          composeOBJECT_REF("contributions", e); // a
5575    }
5576    if (element.hasEhr_status()) {
5577      composeOBJECT_REF("ehr_status", element.getEhr_status());
5578    }
5579    if (element.hasEhr_access()) {
5580      composeOBJECT_REF("ehr_access", element.getEhr_access());
5581    }
5582    if (element.hasCompositions()) { 
5583      for (OBJECT_REF e : element.getCompositionsList()) 
5584          composeOBJECT_REF("compositions", e); // a
5585    }
5586    if (element.hasDirectory()) {
5587      composeOBJECT_REF("directory", element.getDirectory());
5588    }
5589    if (element.hasTime_created()) {
5590      composeDV_DATE_TIME("time_created", element.getTime_created());
5591    }
5592    if (element.hasFolders()) { 
5593      for (OBJECT_REF e : element.getFoldersList()) 
5594          composeOBJECT_REF("folders", e); // a
5595    }
5596    if (element.hasTags()) { 
5597      for (OBJECT_REF e : element.getTagsList()) 
5598          composeOBJECT_REF("tags", e); // a
5599    }
5600  }
5601
5602  protected void composeELEMENT(String name, ELEMENT element) throws IOException {
5603    if (element != null) {
5604      xml.enter(FHIR_NS, name);
5605      composeELEMENTElements(element);
5606      composeElementClose(element);
5607      xml.exit(FHIR_NS, name);
5608    }
5609  }
5610
5611  protected void composeELEMENTElements(ELEMENT element) throws IOException {
5612    composeITEMElements(element);
5613    if (element.hasNull_flavour()) {
5614      composeDV_CODED_TEXT("null_flavour", element.getNull_flavour());
5615    }
5616    if (element.hasValue()) {
5617      composeDATA_VALUE("value", element.getValue());
5618    }
5619    if (element.hasNull_reason()) {
5620      composeDV_TEXT("null_reason", element.getNull_reason());
5621    }
5622  }
5623
5624  protected void composeEVALUATION(String name, EVALUATION element) throws IOException {
5625    if (element != null) {
5626      xml.enter(FHIR_NS, name);
5627      composeEVALUATIONElements(element);
5628      composeElementClose(element);
5629      xml.exit(FHIR_NS, name);
5630    }
5631  }
5632
5633  protected void composeEVALUATIONElements(EVALUATION element) throws IOException {
5634    composeCARE_ENTRYElements(element);
5635    if (element.hasData()) {
5636      composeITEM_STRUCTURE("data", element.getData());
5637    }
5638  }
5639
5640  protected void composeEVENT_CONTEXT(String name, EVENT_CONTEXT element) throws IOException {
5641    if (element != null) {
5642      xml.enter(FHIR_NS, name);
5643      composeEVENT_CONTEXTElements(element);
5644      composeElementClose(element);
5645      xml.exit(FHIR_NS, name);
5646    }
5647  }
5648
5649  protected void composeEVENT_CONTEXTElements(EVENT_CONTEXT element) throws IOException {
5650    composeLOCATABLEElements(element);
5651    if (element.hasStart_time()) {
5652      composeDV_DATE_TIME("start_time", element.getStart_time());
5653    }
5654    if (element.hasEnd_time()) {
5655      composeDV_DATE_TIME("end_time", element.getEnd_time());
5656    }
5657    if (element.hasLocationElement()) {
5658      composeString("location", element.getLocationElement());
5659    }
5660    if (element.hasSetting()) {
5661      composeDV_CODED_TEXT("setting", element.getSetting());
5662    }
5663    if (element.hasOther_context()) {
5664      composeITEM_STRUCTURE("other_context", element.getOther_context());
5665    }
5666    if (element.hasHealth_care_facility()) {
5667      composePARTY_IDENTIFIED("health_care_facility", element.getHealth_care_facility());
5668    }
5669    if (element.hasParticipations()) { 
5670      for (PARTICIPATION e : element.getParticipationsList()) 
5671          composePARTICIPATION("participations", e); // a
5672    }
5673  }
5674
5675  protected void composeFEEDER_AUDIT_DETAILS(String name, FEEDER_AUDIT_DETAILS element) throws IOException {
5676    if (element != null) {
5677      xml.enter(FHIR_NS, name);
5678      composeFEEDER_AUDIT_DETAILSElements(element);
5679      composeElementClose(element);
5680      xml.exit(FHIR_NS, name);
5681    }
5682  }
5683
5684  protected void composeFEEDER_AUDIT_DETAILSElements(FEEDER_AUDIT_DETAILS element) throws IOException {
5685    composeBaseElements(element);
5686    if (element.hasSystem_idElement()) {
5687      composeString("system_id", element.getSystem_idElement());
5688    }
5689    if (element.hasLocation()) {
5690      composePARTY_IDENTIFIED("location", element.getLocation());
5691    }
5692    if (element.hasSubject()) {
5693      composePARTY_PROXY("subject", element.getSubject());
5694    }
5695    if (element.hasProvider()) {
5696      composePARTY_IDENTIFIED("provider", element.getProvider());
5697    }
5698    if (element.hasTime()) {
5699      composeDV_DATE_TIME("time", element.getTime());
5700    }
5701    if (element.hasVersion_idElement()) {
5702      composeString("version_id", element.getVersion_idElement());
5703    }
5704    if (element.hasOther_details()) {
5705      composeITEM_STRUCTURE("other_details", element.getOther_details());
5706    }
5707  }
5708
5709  protected void composeFEEDER_AUDIT(String name, FEEDER_AUDIT element) throws IOException {
5710    if (element != null) {
5711      xml.enter(FHIR_NS, name);
5712      composeFEEDER_AUDITElements(element);
5713      composeElementClose(element);
5714      xml.exit(FHIR_NS, name);
5715    }
5716  }
5717
5718  protected void composeFEEDER_AUDITElements(FEEDER_AUDIT element) throws IOException {
5719    composeBaseElements(element);
5720    if (element.hasOriginating_system_item_ids()) { 
5721      for (DV_IDENTIFIER e : element.getOriginating_system_item_idsList()) 
5722          composeDV_IDENTIFIER("originating_system_item_ids", e); // a
5723    }
5724    if (element.hasFeeder_system_item_ids()) { 
5725      for (DV_IDENTIFIER e : element.getFeeder_system_item_idsList()) 
5726          composeDV_IDENTIFIER("feeder_system_item_ids", e); // a
5727    }
5728    if (element.hasOriginal_content()) {
5729      composeDV_ENCAPSULATED("original_content", element.getOriginal_content());
5730    }
5731    if (element.hasOriginating_system_audit()) {
5732      composeFEEDER_AUDIT_DETAILS("originating_system_audit", element.getOriginating_system_audit());
5733    }
5734    if (element.hasFeeder_system_audit()) {
5735      composeFEEDER_AUDIT_DETAILS("feeder_system_audit", element.getFeeder_system_audit());
5736    }
5737  }
5738
5739  protected void composeFOLDER(String name, FOLDER element) throws IOException {
5740    if (element != null) {
5741      xml.enter(FHIR_NS, name);
5742      composeFOLDERElements(element);
5743      composeElementClose(element);
5744      xml.exit(FHIR_NS, name);
5745    }
5746  }
5747
5748  protected void composeFOLDERElements(FOLDER element) throws IOException {
5749    composeLOCATABLEElements(element);
5750    if (element.hasItems()) { 
5751      for (OBJECT_REF e : element.getItemsList()) 
5752          composeOBJECT_REF("items", e); // a
5753    }
5754    if (element.hasFolders()) { 
5755      for (FOLDER e : element.getFoldersList()) 
5756          composeFOLDER("folders", e); // a
5757    }
5758    if (element.hasDetails()) {
5759      composeITEM_STRUCTURE("details", element.getDetails());
5760    }
5761  }
5762
5763  protected void composeGENERIC_ID(String name, GENERIC_ID element) throws IOException {
5764    if (element != null) {
5765      xml.enter(FHIR_NS, name);
5766      composeGENERIC_IDElements(element);
5767      composeElementClose(element);
5768      xml.exit(FHIR_NS, name);
5769    }
5770  }
5771
5772  protected void composeGENERIC_IDElements(GENERIC_ID element) throws IOException {
5773    composeOBJECT_IDElements(element);
5774  }
5775
5776  protected void composeGROUP(String name, GROUP element) throws IOException {
5777    if (element != null) {
5778      xml.enter(FHIR_NS, name);
5779      composeGROUPElements(element);
5780      composeElementClose(element);
5781      xml.exit(FHIR_NS, name);
5782    }
5783  }
5784
5785  protected void composeGROUPElements(GROUP element) throws IOException {
5786    composeACTORElements(element);
5787  }
5788
5789  protected void composeHIER_OBJECT_ID(String name, HIER_OBJECT_ID element) throws IOException {
5790    if (element != null) {
5791      xml.enter(FHIR_NS, name);
5792      composeHIER_OBJECT_IDElements(element);
5793      composeElementClose(element);
5794      xml.exit(FHIR_NS, name);
5795    }
5796  }
5797
5798  protected void composeHIER_OBJECT_IDElements(HIER_OBJECT_ID element) throws IOException {
5799    composeUID_BASED_IDElements(element);
5800  }
5801
5802  protected void composeHISTORY(String name, HISTORY element) throws IOException {
5803    if (element != null) {
5804      xml.enter(FHIR_NS, name);
5805      composeHISTORYElements(element);
5806      composeElementClose(element);
5807      xml.exit(FHIR_NS, name);
5808    }
5809  }
5810
5811  protected void composeHISTORYElements(HISTORY element) throws IOException {
5812    composeDATA_STRUCTUREElements(element);
5813    if (element.hasOrigin()) {
5814      composeDV_DATE_TIME("origin", element.getOrigin());
5815    }
5816    if (element.hasPeriod()) {
5817      composeDV_DURATION("period", element.getPeriod());
5818    }
5819    if (element.hasDuration()) {
5820      composeDV_DURATION("duration", element.getDuration());
5821    }
5822    if (element.hasSummary()) {
5823      composeITEM_STRUCTURE("summary", element.getSummary());
5824    }
5825    if (element.hasEvents()) { 
5826      for (EVENT e : element.getEventsList()) 
5827          composeEVENT("events", e); // a
5828    }
5829  }
5830
5831  protected void composeIMPORTED_VERSION(String name, IMPORTED_VERSION element) throws IOException {
5832    if (element != null) {
5833      xml.enter(FHIR_NS, name);
5834      composeIMPORTED_VERSIONElements(element);
5835      composeElementClose(element);
5836      xml.exit(FHIR_NS, name);
5837    }
5838  }
5839
5840  protected void composeIMPORTED_VERSIONElements(IMPORTED_VERSION element) throws IOException {
5841    composeVERSIONElements(element);
5842    if (element.hasItem()) {
5843      composeORIGINAL_VERSION("item", element.getItem());
5844    }
5845  }
5846
5847  protected void composeINSTRUCTION_DETAILS(String name, INSTRUCTION_DETAILS element) throws IOException {
5848    if (element != null) {
5849      xml.enter(FHIR_NS, name);
5850      composeINSTRUCTION_DETAILSElements(element);
5851      composeElementClose(element);
5852      xml.exit(FHIR_NS, name);
5853    }
5854  }
5855
5856  protected void composeINSTRUCTION_DETAILSElements(INSTRUCTION_DETAILS element) throws IOException {
5857    composePATHABLEElements(element);
5858    if (element.hasInstruction_id()) {
5859      composeLOCATABLE_REF("instruction_id", element.getInstruction_id());
5860    }
5861    if (element.hasActivity_idElement()) {
5862      composeString("activity_id", element.getActivity_idElement());
5863    }
5864    if (element.hasWf_details()) {
5865      composeITEM_STRUCTURE("wf_details", element.getWf_details());
5866    }
5867  }
5868
5869  protected void composeINSTRUCTION(String name, INSTRUCTION element) throws IOException {
5870    if (element != null) {
5871      xml.enter(FHIR_NS, name);
5872      composeINSTRUCTIONElements(element);
5873      composeElementClose(element);
5874      xml.exit(FHIR_NS, name);
5875    }
5876  }
5877
5878  protected void composeINSTRUCTIONElements(INSTRUCTION element) throws IOException {
5879    composeCARE_ENTRYElements(element);
5880    if (element.hasNarrative()) {
5881      composeDV_TEXT("narrative", element.getNarrative());
5882    }
5883    if (element.hasExpiry_time()) {
5884      composeDV_DATE_TIME("expiry_time", element.getExpiry_time());
5885    }
5886    if (element.hasWf_definition()) {
5887      composeDV_PARSABLE("wf_definition", element.getWf_definition());
5888    }
5889    if (element.hasActivities()) { 
5890      for (ACTIVITY e : element.getActivitiesList()) 
5891          composeACTIVITY("activities", e); // a
5892    }
5893  }
5894
5895  protected void composeINTERNET_ID(String name, INTERNET_ID element) throws IOException {
5896    if (element != null) {
5897      xml.enter(FHIR_NS, name);
5898      composeINTERNET_IDElements(element);
5899      composeElementClose(element);
5900      xml.exit(FHIR_NS, name);
5901    }
5902  }
5903
5904  protected void composeINTERNET_IDElements(INTERNET_ID element) throws IOException {
5905    composeUIDElements(element);
5906  }
5907
5908  protected void composeINTERVAL_EVENT(String name, INTERVAL_EVENT element) throws IOException {
5909    if (element != null) {
5910      xml.enter(FHIR_NS, name);
5911      composeINTERVAL_EVENTElements(element);
5912      composeElementClose(element);
5913      xml.exit(FHIR_NS, name);
5914    }
5915  }
5916
5917  protected void composeINTERVAL_EVENTElements(INTERVAL_EVENT element) throws IOException {
5918    composeEVENTElements(element);
5919    if (element.hasWidth()) {
5920      composeDV_DURATION("width", element.getWidth());
5921    }
5922    if (element.hasSample_countElement()) {
5923      composeInteger("sample_count", element.getSample_countElement());
5924    }
5925    if (element.hasMath_function()) {
5926      composeDV_CODED_TEXT("math_function", element.getMath_function());
5927    }
5928  }
5929
5930  protected void composeISM_TRANSITION(String name, ISM_TRANSITION element) throws IOException {
5931    if (element != null) {
5932      xml.enter(FHIR_NS, name);
5933      composeISM_TRANSITIONElements(element);
5934      composeElementClose(element);
5935      xml.exit(FHIR_NS, name);
5936    }
5937  }
5938
5939  protected void composeISM_TRANSITIONElements(ISM_TRANSITION element) throws IOException {
5940    composePATHABLEElements(element);
5941    if (element.hasCurrent_state()) {
5942      composeDV_CODED_TEXT("current_state", element.getCurrent_state());
5943    }
5944    if (element.hasTransition()) {
5945      composeDV_CODED_TEXT("transition", element.getTransition());
5946    }
5947    if (element.hasCareflow_step()) {
5948      composeDV_CODED_TEXT("careflow_step", element.getCareflow_step());
5949    }
5950    if (element.hasReason()) { 
5951      for (DV_TEXT e : element.getReasonList()) 
5952          composeDV_TEXT("reason", e); // a
5953    }
5954  }
5955
5956  protected void composeISO_OID(String name, ISO_OID element) throws IOException {
5957    if (element != null) {
5958      xml.enter(FHIR_NS, name);
5959      composeISO_OIDElements(element);
5960      composeElementClose(element);
5961      xml.exit(FHIR_NS, name);
5962    }
5963  }
5964
5965  protected void composeISO_OIDElements(ISO_OID element) throws IOException {
5966    composeUIDElements(element);
5967  }
5968
5969  protected void composeITEM_LIST(String name, ITEM_LIST element) throws IOException {
5970    if (element != null) {
5971      xml.enter(FHIR_NS, name);
5972      composeITEM_LISTElements(element);
5973      composeElementClose(element);
5974      xml.exit(FHIR_NS, name);
5975    }
5976  }
5977
5978  protected void composeITEM_LISTElements(ITEM_LIST element) throws IOException {
5979    composeITEM_STRUCTUREElements(element);
5980    if (element.hasItems()) { 
5981      for (ELEMENT e : element.getItemsList()) 
5982          composeELEMENT("items", e); // a
5983    }
5984  }
5985
5986  protected void composeITEM_SINGLE(String name, ITEM_SINGLE element) throws IOException {
5987    if (element != null) {
5988      xml.enter(FHIR_NS, name);
5989      composeITEM_SINGLEElements(element);
5990      composeElementClose(element);
5991      xml.exit(FHIR_NS, name);
5992    }
5993  }
5994
5995  protected void composeITEM_SINGLEElements(ITEM_SINGLE element) throws IOException {
5996    composeITEM_STRUCTUREElements(element);
5997    if (element.hasItem()) {
5998      composeELEMENT("item", element.getItem());
5999    }
6000  }
6001
6002  protected void composeITEM_TABLE(String name, ITEM_TABLE element) throws IOException {
6003    if (element != null) {
6004      xml.enter(FHIR_NS, name);
6005      composeITEM_TABLEElements(element);
6006      composeElementClose(element);
6007      xml.exit(FHIR_NS, name);
6008    }
6009  }
6010
6011  protected void composeITEM_TABLEElements(ITEM_TABLE element) throws IOException {
6012    composeITEM_STRUCTUREElements(element);
6013    if (element.hasRows()) { 
6014      for (CLUSTER e : element.getRowsList()) 
6015          composeCLUSTER("rows", e); // a
6016    }
6017  }
6018
6019  protected void composeITEM_TAG(String name, ITEM_TAG element) throws IOException {
6020    if (element != null) {
6021      xml.enter(FHIR_NS, name);
6022      composeITEM_TAGElements(element);
6023      composeElementClose(element);
6024      xml.exit(FHIR_NS, name);
6025    }
6026  }
6027
6028  protected void composeITEM_TAGElements(ITEM_TAG element) throws IOException {
6029    composeBaseElements(element);
6030    if (element.hasKeyElement()) {
6031      composeString("key", element.getKeyElement());
6032    }
6033    if (element.hasValueElement()) {
6034      composeString("value", element.getValueElement());
6035    }
6036    if (element.hasTarget()) {
6037      composeUID_BASED_ID("target", element.getTarget());
6038    }
6039    if (element.hasTarget_pathElement()) {
6040      composeString("target_path", element.getTarget_pathElement());
6041    }
6042    if (element.hasOwner_id()) {
6043      composeOBJECT_REF("owner_id", element.getOwner_id());
6044    }
6045  }
6046
6047  protected void composeITEM_TREE(String name, ITEM_TREE element) throws IOException {
6048    if (element != null) {
6049      xml.enter(FHIR_NS, name);
6050      composeITEM_TREEElements(element);
6051      composeElementClose(element);
6052      xml.exit(FHIR_NS, name);
6053    }
6054  }
6055
6056  protected void composeITEM_TREEElements(ITEM_TREE element) throws IOException {
6057    composeITEM_STRUCTUREElements(element);
6058    if (element.hasItems()) { 
6059      for (ITEM e : element.getItemsList()) 
6060          composeITEM("items", e); // a
6061    }
6062  }
6063
6064  protected void composeLINK(String name, LINK element) throws IOException {
6065    if (element != null) {
6066      xml.enter(FHIR_NS, name);
6067      composeLINKElements(element);
6068      composeElementClose(element);
6069      xml.exit(FHIR_NS, name);
6070    }
6071  }
6072
6073  protected void composeLINKElements(LINK element) throws IOException {
6074    composeBaseElements(element);
6075    if (element.hasMeaning()) {
6076      composeDV_TEXT("meaning", element.getMeaning());
6077    }
6078    if (element.hasType()) {
6079      composeDV_TEXT("type", element.getType());
6080    }
6081    if (element.hasTarget()) {
6082      composeDV_EHR_URI("target", element.getTarget());
6083    }
6084  }
6085
6086  protected void composeLOCATABLE_REF(String name, LOCATABLE_REF element) throws IOException {
6087    if (element != null) {
6088      xml.enter(FHIR_NS, name);
6089      composeLOCATABLE_REFElements(element);
6090      composeElementClose(element);
6091      xml.exit(FHIR_NS, name);
6092    }
6093  }
6094
6095  protected void composeLOCATABLE_REFElements(LOCATABLE_REF element) throws IOException {
6096    composeOBJECT_REFElements(element);
6097    if (element.hasPathElement()) {
6098      composeString("path", element.getPathElement());
6099    }
6100  }
6101
6102  protected void composeOBJECT_REF(String name, OBJECT_REF element) throws IOException {
6103    if (element != null) {
6104      xml.enter(FHIR_NS, name);
6105      composeOBJECT_REFElements(element);
6106      composeElementClose(element);
6107      xml.exit(FHIR_NS, name);
6108    }
6109  }
6110
6111  protected void composeOBJECT_REFElements(OBJECT_REF element) throws IOException {
6112    composeBaseElements(element);
6113    if (element.hasNamespaceElement()) {
6114      composeString("namespace", element.getNamespaceElement());
6115    }
6116    if (element.hasTypeElement()) {
6117      composeString("type", element.getTypeElement());
6118    }
6119    if (element.hasId()) {
6120      composeOBJECT_ID("id", element.getId());
6121    }
6122  }
6123
6124  protected void composeOBJECT_VERSION_ID(String name, OBJECT_VERSION_ID element) throws IOException {
6125    if (element != null) {
6126      xml.enter(FHIR_NS, name);
6127      composeOBJECT_VERSION_IDElements(element);
6128      composeElementClose(element);
6129      xml.exit(FHIR_NS, name);
6130    }
6131  }
6132
6133  protected void composeOBJECT_VERSION_IDElements(OBJECT_VERSION_ID element) throws IOException {
6134    composeUID_BASED_IDElements(element);
6135  }
6136
6137  protected void composeOBSERVATION(String name, OBSERVATION element) throws IOException {
6138    if (element != null) {
6139      xml.enter(FHIR_NS, name);
6140      composeOBSERVATIONElements(element);
6141      composeElementClose(element);
6142      xml.exit(FHIR_NS, name);
6143    }
6144  }
6145
6146  protected void composeOBSERVATIONElements(OBSERVATION element) throws IOException {
6147    composeCARE_ENTRYElements(element);
6148    if (element.hasData()) {
6149      composeHISTORY("data", element.getData());
6150    }
6151    if (element.hasState()) {
6152      composeHISTORY("state", element.getState());
6153    }
6154  }
6155
6156  protected void composeORGANISATION(String name, ORGANISATION element) throws IOException {
6157    if (element != null) {
6158      xml.enter(FHIR_NS, name);
6159      composeORGANISATIONElements(element);
6160      composeElementClose(element);
6161      xml.exit(FHIR_NS, name);
6162    }
6163  }
6164
6165  protected void composeORGANISATIONElements(ORGANISATION element) throws IOException {
6166    composeACTORElements(element);
6167  }
6168
6169  protected void composeORIGINAL_VERSION(String name, ORIGINAL_VERSION element) throws IOException {
6170    if (element != null) {
6171      xml.enter(FHIR_NS, name);
6172      composeORIGINAL_VERSIONElements(element);
6173      composeElementClose(element);
6174      xml.exit(FHIR_NS, name);
6175    }
6176  }
6177
6178  protected void composeORIGINAL_VERSIONElements(ORIGINAL_VERSION element) throws IOException {
6179    composeVERSIONElements(element);
6180    if (element.hasUid()) {
6181      composeOBJECT_VERSION_ID("uid", element.getUid());
6182    }
6183    if (element.hasPreceding_version_uid()) {
6184      composeOBJECT_VERSION_ID("preceding_version_uid", element.getPreceding_version_uid());
6185    }
6186    if (element.hasOther_input_version_uids()) { 
6187      for (OBJECT_VERSION_ID e : element.getOther_input_version_uidsList()) 
6188          composeOBJECT_VERSION_ID("other_input_version_uids", e); // a
6189    }
6190    if (element.hasLifecycle_state()) {
6191      composeDV_CODED_TEXT("lifecycle_state", element.getLifecycle_state());
6192    }
6193    if (element.hasAttestations()) { 
6194      for (ATTESTATION e : element.getAttestationsList()) 
6195          composeATTESTATION("attestations", e); // a
6196    }
6197    if (element.hasData()) {
6198      composeAny("data", element.getData());
6199    }
6200  }
6201
6202  protected void composePARTICIPATION(String name, PARTICIPATION element) throws IOException {
6203    if (element != null) {
6204      xml.enter(FHIR_NS, name);
6205      composePARTICIPATIONElements(element);
6206      composeElementClose(element);
6207      xml.exit(FHIR_NS, name);
6208    }
6209  }
6210
6211  protected void composePARTICIPATIONElements(PARTICIPATION element) throws IOException {
6212    composeLOCATABLEElements(element);
6213    if (element.hasFunction()) {
6214      composeDV_TEXT("function", element.getFunction());
6215    }
6216    if (element.hasMode()) {
6217      composeDV_CODED_TEXT("mode", element.getMode());
6218    }
6219    if (element.hasPerformer()) {
6220      composePARTY_PROXY("performer", element.getPerformer());
6221    }
6222    if (element.hasTime()) {
6223      composeDV_INTERVAL("time", element.getTime());
6224    }
6225  }
6226
6227  protected void composePARTY_IDENTIFIED(String name, PARTY_IDENTIFIED element) throws IOException {
6228    if (element != null) {
6229      xml.enter(FHIR_NS, name);
6230      composePARTY_IDENTIFIEDElements(element);
6231      composeElementClose(element);
6232      xml.exit(FHIR_NS, name);
6233    }
6234  }
6235
6236  protected void composePARTY_IDENTIFIEDElements(PARTY_IDENTIFIED element) throws IOException {
6237    composePARTY_PROXYElements(element);
6238    if (element.hasNameElement()) {
6239      composeString("name", element.getNameElement());
6240    }
6241    if (element.hasIdentifiers()) { 
6242      for (DV_IDENTIFIER e : element.getIdentifiersList()) 
6243          composeDV_IDENTIFIER("identifiers", e); // a
6244    }
6245  }
6246
6247  protected void composePARTY_IDENTITY(String name, PARTY_IDENTITY element) throws IOException {
6248    if (element != null) {
6249      xml.enter(FHIR_NS, name);
6250      composePARTY_IDENTITYElements(element);
6251      composeElementClose(element);
6252      xml.exit(FHIR_NS, name);
6253    }
6254  }
6255
6256  protected void composePARTY_IDENTITYElements(PARTY_IDENTITY element) throws IOException {
6257    composeLOCATABLEElements(element);
6258    if (element.hasDetails()) {
6259      composeITEM_STRUCTURE("details", element.getDetails());
6260    }
6261  }
6262
6263  protected void composePARTY_REF(String name, PARTY_REF element) throws IOException {
6264    if (element != null) {
6265      xml.enter(FHIR_NS, name);
6266      composePARTY_REFElements(element);
6267      composeElementClose(element);
6268      xml.exit(FHIR_NS, name);
6269    }
6270  }
6271
6272  protected void composePARTY_REFElements(PARTY_REF element) throws IOException {
6273    composeOBJECT_REFElements(element);
6274  }
6275
6276  protected void composePARTY_RELATED(String name, PARTY_RELATED element) throws IOException {
6277    if (element != null) {
6278      xml.enter(FHIR_NS, name);
6279      composePARTY_RELATEDElements(element);
6280      composeElementClose(element);
6281      xml.exit(FHIR_NS, name);
6282    }
6283  }
6284
6285  protected void composePARTY_RELATEDElements(PARTY_RELATED element) throws IOException {
6286    composePARTY_IDENTIFIEDElements(element);
6287    if (element.hasRelationship()) {
6288      composeDV_CODED_TEXT("relationship", element.getRelationship());
6289    }
6290  }
6291
6292  protected void composePARTY_RELATIONSHIP(String name, PARTY_RELATIONSHIP element) throws IOException {
6293    if (element != null) {
6294      xml.enter(FHIR_NS, name);
6295      composePARTY_RELATIONSHIPElements(element);
6296      composeElementClose(element);
6297      xml.exit(FHIR_NS, name);
6298    }
6299  }
6300
6301  protected void composePARTY_RELATIONSHIPElements(PARTY_RELATIONSHIP element) throws IOException {
6302    composeLOCATABLEElements(element);
6303    if (element.hasDetails()) {
6304      composeITEM_STRUCTURE("details", element.getDetails());
6305    }
6306    if (element.hasTarget()) {
6307      composePARTY_REF("target", element.getTarget());
6308    }
6309    if (element.hasTime_validity()) {
6310      composeDV_INTERVAL("time_validity", element.getTime_validity());
6311    }
6312    if (element.hasSource()) {
6313      composePARTY_REF("source", element.getSource());
6314    }
6315  }
6316
6317  protected void composePARTY_SELF(String name, PARTY_SELF element) throws IOException {
6318    if (element != null) {
6319      xml.enter(FHIR_NS, name);
6320      composePARTY_SELFElements(element);
6321      composeElementClose(element);
6322      xml.exit(FHIR_NS, name);
6323    }
6324  }
6325
6326  protected void composePARTY_SELFElements(PARTY_SELF element) throws IOException {
6327    composePARTY_PROXYElements(element);
6328  }
6329
6330  protected void composePERSON(String name, PERSON element) throws IOException {
6331    if (element != null) {
6332      xml.enter(FHIR_NS, name);
6333      composePERSONElements(element);
6334      composeElementClose(element);
6335      xml.exit(FHIR_NS, name);
6336    }
6337  }
6338
6339  protected void composePERSONElements(PERSON element) throws IOException {
6340    composeACTORElements(element);
6341  }
6342
6343  protected void composePOINT_EVENT(String name, POINT_EVENT element) throws IOException {
6344    if (element != null) {
6345      xml.enter(FHIR_NS, name);
6346      composePOINT_EVENTElements(element);
6347      composeElementClose(element);
6348      xml.exit(FHIR_NS, name);
6349    }
6350  }
6351
6352  protected void composePOINT_EVENTElements(POINT_EVENT element) throws IOException {
6353    composeEVENTElements(element);
6354  }
6355
6356  protected void composeREFERENCE_RANGE(String name, REFERENCE_RANGE element) throws IOException {
6357    if (element != null) {
6358      xml.enter(FHIR_NS, name);
6359      composeREFERENCE_RANGEElements(element);
6360      composeElementClose(element);
6361      xml.exit(FHIR_NS, name);
6362    }
6363  }
6364
6365  protected void composeREFERENCE_RANGEElements(REFERENCE_RANGE element) throws IOException {
6366    composeBaseElements(element);
6367    if (element.hasMeaning()) {
6368      composeDV_TEXT("meaning", element.getMeaning());
6369    }
6370    if (element.hasRange()) {
6371      composeDV_INTERVAL("range", element.getRange());
6372    }
6373  }
6374
6375  protected void composeRESOURCE_DESCRIPTION_ITEM(String name, RESOURCE_DESCRIPTION_ITEM element) throws IOException {
6376    if (element != null) {
6377      xml.enter(FHIR_NS, name);
6378      composeRESOURCE_DESCRIPTION_ITEMElements(element);
6379      composeElementClose(element);
6380      xml.exit(FHIR_NS, name);
6381    }
6382  }
6383
6384  protected void composeRESOURCE_DESCRIPTION_ITEMElements(RESOURCE_DESCRIPTION_ITEM element) throws IOException {
6385    composeBaseElements(element);
6386    if (element.hasLanguage()) {
6387      composeCODE_PHRASE("language", element.getLanguage());
6388    }
6389    if (element.hasPurposeElement()) {
6390      composeString("purpose", element.getPurposeElement());
6391    }
6392    if (element.hasKeywords()) { 
6393      for (StringType e : element.getKeywordsList()) 
6394          composeString("keywords", e); // a
6395    }
6396    if (element.hasUseElement()) {
6397      composeString("use", element.getUseElement());
6398    }
6399    if (element.hasMisuseElement()) {
6400      composeString("misuse", element.getMisuseElement());
6401    }
6402    if (element.hasCopyrightElement()) {
6403      composeString("copyright", element.getCopyrightElement());
6404    }
6405    if (element.hasOriginal_resource_uri()) { 
6406      for (StringType e : element.getOriginal_resource_uriList()) 
6407          composeString("original_resource_uri", e); // a
6408    }
6409    if (element.hasOther_details()) { 
6410      for (StringType e : element.getOther_detailsList()) 
6411          composeString("other_details", e); // a
6412    }
6413  }
6414
6415  protected void composeRESOURCE_DESCRIPTION(String name, RESOURCE_DESCRIPTION element) throws IOException {
6416    if (element != null) {
6417      xml.enter(FHIR_NS, name);
6418      composeRESOURCE_DESCRIPTIONElements(element);
6419      composeElementClose(element);
6420      xml.exit(FHIR_NS, name);
6421    }
6422  }
6423
6424  protected void composeRESOURCE_DESCRIPTIONElements(RESOURCE_DESCRIPTION element) throws IOException {
6425    composeBaseElements(element);
6426    if (element.hasOriginal_author()) { 
6427      for (StringType e : element.getOriginal_authorList()) 
6428          composeString("original_author", e); // a
6429    }
6430    if (element.hasOther_contributors()) { 
6431      for (StringType e : element.getOther_contributorsList()) 
6432          composeString("other_contributors", e); // a
6433    }
6434    if (element.hasLifecycle_stateElement()) {
6435      composeString("lifecycle_state", element.getLifecycle_stateElement());
6436    }
6437    if (element.hasResource_package_uriElement()) {
6438      composeString("resource_package_uri", element.getResource_package_uriElement());
6439    }
6440    if (element.hasOther_details()) { 
6441      for (OBJECT_REF e : element.getOther_detailsList()) 
6442          composeOBJECT_REF("other_details", e); // a
6443    }
6444    if (element.hasParent_resource()) {
6445      composeAUTHORED_RESOURCE("parent_resource", element.getParent_resource());
6446    }
6447    if (element.hasDetails()) { 
6448      for (RESOURCE_DESCRIPTION_ITEM e : element.getDetailsList()) 
6449          composeRESOURCE_DESCRIPTION_ITEM("details", e); // a
6450    }
6451  }
6452
6453  protected void composeREVISION_HISTORY_ITEM(String name, REVISION_HISTORY_ITEM element) throws IOException {
6454    if (element != null) {
6455      xml.enter(FHIR_NS, name);
6456      composeREVISION_HISTORY_ITEMElements(element);
6457      composeElementClose(element);
6458      xml.exit(FHIR_NS, name);
6459    }
6460  }
6461
6462  protected void composeREVISION_HISTORY_ITEMElements(REVISION_HISTORY_ITEM element) throws IOException {
6463    composeBaseElements(element);
6464    if (element.hasVersion_id()) {
6465      composeOBJECT_VERSION_ID("version_id", element.getVersion_id());
6466    }
6467    if (element.hasAudits()) { 
6468      for (AUDIT_DETAILS e : element.getAuditsList()) 
6469          composeAUDIT_DETAILS("audits", e); // a
6470    }
6471  }
6472
6473  protected void composeREVISION_HISTORY(String name, REVISION_HISTORY element) throws IOException {
6474    if (element != null) {
6475      xml.enter(FHIR_NS, name);
6476      composeREVISION_HISTORYElements(element);
6477      composeElementClose(element);
6478      xml.exit(FHIR_NS, name);
6479    }
6480  }
6481
6482  protected void composeREVISION_HISTORYElements(REVISION_HISTORY element) throws IOException {
6483    composeBaseElements(element);
6484    if (element.hasMost_recent_versionElement()) {
6485      composeString("most_recent_version", element.getMost_recent_versionElement());
6486    }
6487    if (element.hasMost_recent_version_time_committedElement()) {
6488      composeString("most_recent_version_time_committed", element.getMost_recent_version_time_committedElement());
6489    }
6490  }
6491
6492  protected void composeROLE(String name, ROLE element) throws IOException {
6493    if (element != null) {
6494      xml.enter(FHIR_NS, name);
6495      composeROLEElements(element);
6496      composeElementClose(element);
6497      xml.exit(FHIR_NS, name);
6498    }
6499  }
6500
6501  protected void composeROLEElements(ROLE element) throws IOException {
6502    composePARTYElements(element);
6503    if (element.hasTime_validity()) {
6504      composeDV_INTERVAL("time_validity", element.getTime_validity());
6505    }
6506    if (element.hasPerformer()) {
6507      composePARTY_REF("performer", element.getPerformer());
6508    }
6509    if (element.hasCapabilities()) { 
6510      for (CAPABILITY e : element.getCapabilitiesList()) 
6511          composeCAPABILITY("capabilities", e); // a
6512    }
6513  }
6514
6515  protected void composeSECTION(String name, SECTION element) throws IOException {
6516    if (element != null) {
6517      xml.enter(FHIR_NS, name);
6518      composeSECTIONElements(element);
6519      composeElementClose(element);
6520      xml.exit(FHIR_NS, name);
6521    }
6522  }
6523
6524  protected void composeSECTIONElements(SECTION element) throws IOException {
6525    composeCONTENT_ITEMElements(element);
6526    if (element.hasItems()) { 
6527      for (CONTENT_ITEM e : element.getItemsList()) 
6528          composeCONTENT_ITEM("items", e); // a
6529    }
6530  }
6531
6532  protected void composeTEMPLATE_ID(String name, TEMPLATE_ID element) throws IOException {
6533    if (element != null) {
6534      xml.enter(FHIR_NS, name);
6535      composeTEMPLATE_IDElements(element);
6536      composeElementClose(element);
6537      xml.exit(FHIR_NS, name);
6538    }
6539  }
6540
6541  protected void composeTEMPLATE_IDElements(TEMPLATE_ID element) throws IOException {
6542    composeOBJECT_IDElements(element);
6543  }
6544
6545  protected void composeTERM_MAPPING(String name, TERM_MAPPING element) throws IOException {
6546    if (element != null) {
6547      xml.enter(FHIR_NS, name);
6548      composeTERM_MAPPINGElements(element);
6549      composeElementClose(element);
6550      xml.exit(FHIR_NS, name);
6551    }
6552  }
6553
6554  protected void composeTERM_MAPPINGElements(TERM_MAPPING element) throws IOException {
6555    composeBaseElements(element);
6556    if (element.hasMatchElement()) {
6557      composeString("match", element.getMatchElement());
6558    }
6559    if (element.hasPurpose()) {
6560      composeDV_CODED_TEXT("purpose", element.getPurpose());
6561    }
6562    if (element.hasTarget()) {
6563      composeCODE_PHRASE("target", element.getTarget());
6564    }
6565  }
6566
6567  protected void composeTERMINOLOGY_ID(String name, TERMINOLOGY_ID element) throws IOException {
6568    if (element != null) {
6569      xml.enter(FHIR_NS, name);
6570      composeTERMINOLOGY_IDElements(element);
6571      composeElementClose(element);
6572      xml.exit(FHIR_NS, name);
6573    }
6574  }
6575
6576  protected void composeTERMINOLOGY_IDElements(TERMINOLOGY_ID element) throws IOException {
6577    composeOBJECT_IDElements(element);
6578  }
6579
6580  protected void composeTRANSLATION_DETAILS(String name, TRANSLATION_DETAILS element) throws IOException {
6581    if (element != null) {
6582      xml.enter(FHIR_NS, name);
6583      composeTRANSLATION_DETAILSElements(element);
6584      composeElementClose(element);
6585      xml.exit(FHIR_NS, name);
6586    }
6587  }
6588
6589  protected void composeTRANSLATION_DETAILSElements(TRANSLATION_DETAILS element) throws IOException {
6590    composeBaseElements(element);
6591    if (element.hasLanguage()) {
6592      composeCODE_PHRASE("language", element.getLanguage());
6593    }
6594    if (element.hasAuthor()) { 
6595      for (StringType e : element.getAuthorList()) 
6596          composeString("author", e); // a
6597    }
6598    if (element.hasAccreditationElement()) {
6599      composeString("accreditation", element.getAccreditationElement());
6600    }
6601    if (element.hasOther_details()) { 
6602      for (StringType e : element.getOther_detailsList()) 
6603          composeString("other_details", e); // a
6604    }
6605  }
6606
6607  protected void composeTranslatedString(String name, TranslatedString element) throws IOException {
6608    if (element != null) {
6609      xml.enter(FHIR_NS, name);
6610      composeTranslatedStringElements(element);
6611      composeElementClose(element);
6612      xml.exit(FHIR_NS, name);
6613    }
6614  }
6615
6616  protected void composeTranslatedStringElements(TranslatedString element) throws IOException {
6617    composeBaseElements(element);
6618    if (element.hasLanguageElement()) {
6619      composeCode("language", element.getLanguageElement());
6620    }
6621    if (element.hasValueElement()) {
6622      composeString("value", element.getValueElement());
6623    }
6624  }
6625
6626  protected void composeUUID(String name, UUID element) throws IOException {
6627    if (element != null) {
6628      xml.enter(FHIR_NS, name);
6629      composeUUIDElements(element);
6630      composeElementClose(element);
6631      xml.exit(FHIR_NS, name);
6632    }
6633  }
6634
6635  protected void composeUUIDElements(UUID element) throws IOException {
6636    composeUIDElements(element);
6637  }
6638
6639  protected void composeVERSION_TREE_ID(String name, VERSION_TREE_ID element) throws IOException {
6640    if (element != null) {
6641      xml.enter(FHIR_NS, name);
6642      composeVERSION_TREE_IDElements(element);
6643      composeElementClose(element);
6644      xml.exit(FHIR_NS, name);
6645    }
6646  }
6647
6648  protected void composeVERSION_TREE_IDElements(VERSION_TREE_ID element) throws IOException {
6649    composeBaseElements(element);
6650    if (element.hasValueElement()) {
6651      composeString("value", element.getValueElement());
6652    }
6653  }
6654
6655  protected void composeVERSIONED_COMPOSITION(String name, VERSIONED_COMPOSITION element) throws IOException {
6656    if (element != null) {
6657      xml.enter(FHIR_NS, name);
6658      composeVERSIONED_COMPOSITIONElements(element);
6659      composeElementClose(element);
6660      xml.exit(FHIR_NS, name);
6661    }
6662  }
6663
6664  protected void composeVERSIONED_COMPOSITIONElements(VERSIONED_COMPOSITION element) throws IOException {
6665    composeVERSIONED_OBJECTElements(element);
6666  }
6667
6668  protected void composeVERSIONED_EHR_ACCESS(String name, VERSIONED_EHR_ACCESS element) throws IOException {
6669    if (element != null) {
6670      xml.enter(FHIR_NS, name);
6671      composeVERSIONED_EHR_ACCESSElements(element);
6672      composeElementClose(element);
6673      xml.exit(FHIR_NS, name);
6674    }
6675  }
6676
6677  protected void composeVERSIONED_EHR_ACCESSElements(VERSIONED_EHR_ACCESS element) throws IOException {
6678    composeVERSIONED_OBJECTElements(element);
6679  }
6680
6681  protected void composeVERSIONED_EHR_STATUS(String name, VERSIONED_EHR_STATUS element) throws IOException {
6682    if (element != null) {
6683      xml.enter(FHIR_NS, name);
6684      composeVERSIONED_EHR_STATUSElements(element);
6685      composeElementClose(element);
6686      xml.exit(FHIR_NS, name);
6687    }
6688  }
6689
6690  protected void composeVERSIONED_EHR_STATUSElements(VERSIONED_EHR_STATUS element) throws IOException {
6691    composeVERSIONED_OBJECTElements(element);
6692  }
6693
6694  protected void composeVERSIONED_FOLDER(String name, VERSIONED_FOLDER element) throws IOException {
6695    if (element != null) {
6696      xml.enter(FHIR_NS, name);
6697      composeVERSIONED_FOLDERElements(element);
6698      composeElementClose(element);
6699      xml.exit(FHIR_NS, name);
6700    }
6701  }
6702
6703  protected void composeVERSIONED_FOLDERElements(VERSIONED_FOLDER element) throws IOException {
6704    composeVERSIONED_OBJECTElements(element);
6705  }
6706
6707  protected void composeVERSIONED_OBJECT(String name, VERSIONED_OBJECT element) throws IOException {
6708    if (element != null) {
6709      xml.enter(FHIR_NS, name);
6710      composeVERSIONED_OBJECTElements(element);
6711      composeElementClose(element);
6712      xml.exit(FHIR_NS, name);
6713    }
6714  }
6715
6716  protected void composeVERSIONED_OBJECTElements(VERSIONED_OBJECT element) throws IOException {
6717    composeBaseElements(element);
6718    if (element.hasUid()) {
6719      composeHIER_OBJECT_ID("uid", element.getUid());
6720    }
6721    if (element.hasOwner_id()) {
6722      composeOBJECT_REF("owner_id", element.getOwner_id());
6723    }
6724    if (element.hasTime_created()) {
6725      composeDV_DATE_TIME("time_created", element.getTime_created());
6726    }
6727  }
6728
6729  protected void composeVERSIONED_PARTY(String name, VERSIONED_PARTY element) throws IOException {
6730    if (element != null) {
6731      xml.enter(FHIR_NS, name);
6732      composeVERSIONED_PARTYElements(element);
6733      composeElementClose(element);
6734      xml.exit(FHIR_NS, name);
6735    }
6736  }
6737
6738  protected void composeVERSIONED_PARTYElements(VERSIONED_PARTY element) throws IOException {
6739    composeVERSIONED_OBJECTElements(element);
6740  }
6741
6742  protected void composeWebTemplate(String name, WebTemplate element) throws IOException {
6743    if (element != null) {
6744      xml.enter(FHIR_NS, name);
6745      composeWebTemplateElements(element);
6746      composeElementClose(element);
6747      xml.exit(FHIR_NS, name);
6748    }
6749  }
6750
6751  protected void composeWebTemplateElements(WebTemplate element) throws IOException {
6752    composeBaseElements(element);
6753    if (element.hasTemplateIdElement()) {
6754      composeString("templateId", element.getTemplateIdElement());
6755    }
6756    if (element.hasVersionElement()) {
6757      composeString("version", element.getVersionElement());
6758    }
6759    if (element.hasSemverElement()) {
6760      composeString("semver", element.getSemverElement());
6761    }
6762    if (element.hasDefaultLanguageElement()) {
6763      composeString("defaultLanguage", element.getDefaultLanguageElement());
6764    }
6765    if (element.hasLanguages()) { 
6766      for (StringType e : element.getLanguagesList()) 
6767          composeString("languages", e); // a
6768    }
6769    if (element.hasTree()) {
6770      composeWebTemplateItem("tree", element.getTree());
6771    }
6772  }
6773
6774  protected void composeWebTemplateInput(String name, WebTemplateInput element) throws IOException {
6775    if (element != null) {
6776      xml.enter(FHIR_NS, name);
6777      composeWebTemplateInputElements(element);
6778      composeElementClose(element);
6779      xml.exit(FHIR_NS, name);
6780    }
6781  }
6782
6783  protected void composeWebTemplateInputElements(WebTemplateInput element) throws IOException {
6784    composeBaseElements(element);
6785    if (element.hasSuffixElement()) {
6786      composeString("suffix", element.getSuffixElement());
6787    }
6788    if (element.hasTypeElement()) {
6789      composeCode("type", element.getTypeElement());
6790    }
6791    if (element.hasDefaultValue()) {
6792      composeNativePrimitive("defaultValue", element.getDefaultValue());
6793    }
6794    if (element.hasTerminologyElement()) {
6795      composeCode("terminology", element.getTerminologyElement());
6796    }
6797    if (element.hasValidation()) {
6798      composeWebTemplateInputValidation("validation", element.getValidation());
6799    }
6800    if (element.hasList()) { 
6801      for (WebTemplateInputListItem e : element.getListList()) 
6802          composeWebTemplateInputListItem("list", e); // a
6803    }
6804    if (element.hasListOpenElement()) {
6805      composeBoolean("listOpen", element.getListOpenElement());
6806    }
6807  }
6808
6809  protected void composeWebTemplateInputListItem(String name, WebTemplateInputListItem element) throws IOException {
6810    if (element != null) {
6811      xml.enter(FHIR_NS, name);
6812      composeWebTemplateInputListItemElements(element);
6813      composeElementClose(element);
6814      xml.exit(FHIR_NS, name);
6815    }
6816  }
6817
6818  protected void composeWebTemplateInputListItemElements(WebTemplateInputListItem element) throws IOException {
6819    composeBaseElements(element);
6820    if (element.hasValueElement()) {
6821      composeCode("value", element.getValueElement());
6822    }
6823    if (element.hasLabelElement()) {
6824      composeString("label", element.getLabelElement());
6825    }
6826    if (element.hasOrdinalElement()) {
6827      composeString("ordinal", element.getOrdinalElement());
6828    }
6829    if (element.hasLocalizedLabels()) { 
6830      for (TranslatedString e : element.getLocalizedLabelsList()) 
6831          composeTranslatedString("localizedLabels", e); // a
6832    }
6833    if (element.hasLocalizedDescriptions()) { 
6834      for (TranslatedString e : element.getLocalizedDescriptionsList()) 
6835          composeTranslatedString("localizedDescriptions", e); // a
6836    }
6837    if (element.hasCurrentStatesElement()) {
6838      composeString("currentStates", element.getCurrentStatesElement());
6839    }
6840    if (element.hasRangeElement()) {
6841      composeString("range", element.getRangeElement());
6842    }
6843    if (element.hasPrecisionElement()) {
6844      composeString("precision", element.getPrecisionElement());
6845    }
6846    if (element.hasTermBindings()) { 
6847      for (WebTemplateTermBinding e : element.getTermBindingsList()) 
6848          composeWebTemplateTermBinding("termBindings", e); // a
6849    }
6850  }
6851
6852  protected void composeWebTemplateInputValidation(String name, WebTemplateInputValidation element) throws IOException {
6853    if (element != null) {
6854      xml.enter(FHIR_NS, name);
6855      composeWebTemplateInputValidationElements(element);
6856      composeElementClose(element);
6857      xml.exit(FHIR_NS, name);
6858    }
6859  }
6860
6861  protected void composeWebTemplateInputValidationElements(WebTemplateInputValidation element) throws IOException {
6862    composeBaseElements(element);
6863    if (element.hasRange()) {
6864      composeWebTemplateInputValidationRange("range", element.getRange());
6865    }
6866    if (element.hasPrecision()) {
6867      composeWebTemplateInputValidationRange("precision", element.getPrecision());
6868    }
6869  }
6870
6871  protected void composeWebTemplateInputValidationRange(String name, WebTemplateInputValidationRange element) throws IOException {
6872    if (element != null) {
6873      xml.enter(FHIR_NS, name);
6874      composeWebTemplateInputValidationRangeElements(element);
6875      composeElementClose(element);
6876      xml.exit(FHIR_NS, name);
6877    }
6878  }
6879
6880  protected void composeWebTemplateInputValidationRangeElements(WebTemplateInputValidationRange element) throws IOException {
6881    composeBaseElements(element);
6882    if (element.hasMinOpElement()) {
6883      composeCode("minOp", element.getMinOpElement());
6884    }
6885    if (element.hasMinElement()) {
6886      composeDecimal("min", element.getMinElement());
6887    }
6888    if (element.hasMaxOpElement()) {
6889      composeCode("maxOp", element.getMaxOpElement());
6890    }
6891    if (element.hasMaxElement()) {
6892      composeDecimal("max", element.getMaxElement());
6893    }
6894  }
6895
6896  protected void composeWebTemplateItem(String name, WebTemplateItem element) throws IOException {
6897    if (element != null) {
6898      xml.enter(FHIR_NS, name);
6899      composeWebTemplateItemElements(element);
6900      composeElementClose(element);
6901      xml.exit(FHIR_NS, name);
6902    }
6903  }
6904
6905  protected void composeWebTemplateItemElements(WebTemplateItem element) throws IOException {
6906    composeBaseElements(element);
6907    if (element.hasIdElement()) {
6908      composeString("id", element.getIdElement());
6909    }
6910    if (element.hasDepthElement()) {
6911      composeInteger("depth", element.getDepthElement());
6912    }
6913    if (element.hasNameElement()) {
6914      composeString("name", element.getNameElement());
6915    }
6916    if (element.hasLocalizedNameElement()) {
6917      composeString("localizedName", element.getLocalizedNameElement());
6918    }
6919    if (element.hasRmTypeElement()) {
6920      composeCode("rmType", element.getRmTypeElement());
6921    }
6922    if (element.hasNodeIdElement()) {
6923      composeString("nodeId", element.getNodeIdElement());
6924    }
6925    if (element.hasMinElement()) {
6926      composeString("min", element.getMinElement());
6927    }
6928    if (element.hasMaxElement()) {
6929      composeString("max", element.getMaxElement());
6930    }
6931    if (element.hasDependsOnElement()) {
6932      composeString("dependsOn", element.getDependsOnElement());
6933    }
6934    if (element.hasLocalizedNames()) { 
6935      for (TranslatedString e : element.getLocalizedNamesList()) 
6936          composeTranslatedString("localizedNames", e); // a
6937    }
6938    if (element.hasLocalizedDescriptions()) { 
6939      for (TranslatedString e : element.getLocalizedDescriptionsList()) 
6940          composeTranslatedString("localizedDescriptions", e); // a
6941    }
6942    if (element.hasAnnotations()) {
6943      composeAnnotations("annotations", element.getAnnotations());
6944    }
6945    if (element.hasArchetype_idElement()) {
6946      composeString("archetype_id", element.getArchetype_idElement());
6947    }
6948    if (element.hasAqlPathElement()) {
6949      composeString("aqlPath", element.getAqlPathElement());
6950    }
6951    if (element.hasCustodian_namespaceElement()) {
6952      composeString("custodian_namespace", element.getCustodian_namespaceElement());
6953    }
6954    if (element.hasCustodian_organisationElement()) {
6955      composeString("custodian_organisation", element.getCustodian_organisationElement());
6956    }
6957    if (element.hasLifecycleStateElement()) {
6958      composeCode("lifecycleState", element.getLifecycleStateElement());
6959    }
6960    if (element.hasOriginal_namespaceElement()) {
6961      composeString("original_namespace", element.getOriginal_namespaceElement());
6962    }
6963    if (element.hasOriginal_publisherElement()) {
6964      composeString("original_publisher", element.getOriginal_publisherElement());
6965    }
6966    if (element.hasProportionTypesElement()) {
6967      composeCode("proportionTypes", element.getProportionTypesElement());
6968    }
6969    if (element.hasRevisionElement()) {
6970      composeString("revision", element.getRevisionElement());
6971    }
6972    if (element.hasInContextElement()) {
6973      composeBoolean("inContext", element.getInContextElement());
6974    }
6975    if (element.hasInputs()) { 
6976      for (WebTemplateInput e : element.getInputsList()) 
6977          composeWebTemplateInput("inputs", e); // a
6978    }
6979    if (element.hasTermBindings()) { 
6980      for (WebTemplateTermBinding e : element.getTermBindingsList()) 
6981          composeWebTemplateTermBinding("termBindings", e); // a
6982    }
6983    if (element.hasChildren()) { 
6984      for (WebTemplateItem e : element.getChildrenList()) 
6985          composeWebTemplateItem("children", e); // a
6986    }
6987  }
6988
6989  protected void composeWebTemplateTermBinding(String name, WebTemplateTermBinding element) throws IOException {
6990    if (element != null) {
6991      xml.enter(FHIR_NS, name);
6992      composeWebTemplateTermBindingElements(element);
6993      composeElementClose(element);
6994      xml.exit(FHIR_NS, name);
6995    }
6996  }
6997
6998  protected void composeWebTemplateTermBindingElements(WebTemplateTermBinding element) throws IOException {
6999    composeBaseElements(element);
7000    if (element.hasCodeElement()) {
7001      composeCode("code", element.getCodeElement());
7002    }
7003    if (element.hasValue()) {
7004      composeWebTemplateTermBindingValue("value", element.getValue());
7005    }
7006  }
7007
7008  protected void composeWebTemplateTermBindingValue(String name, WebTemplateTermBindingValue element) throws IOException {
7009    if (element != null) {
7010      xml.enter(FHIR_NS, name);
7011      composeWebTemplateTermBindingValueElements(element);
7012      composeElementClose(element);
7013      xml.exit(FHIR_NS, name);
7014    }
7015  }
7016
7017  protected void composeWebTemplateTermBindingValueElements(WebTemplateTermBindingValue element) throws IOException {
7018    composeBaseElements(element);
7019    if (element.hasValueElement()) {
7020      composeString("value", element.getValueElement());
7021    }
7022    if (element.hasTerminologyIdElement()) {
7023      composeString("terminologyId", element.getTerminologyIdElement());
7024    }
7025  }
7026
7027
7028
7029  @Override
7030  protected void composeResource(Resource resource) throws IOException {
7031    if (resource == null) {
7032      throw new IOException("resource == null");
7033      
7034    } else {
7035      throw new Error("Unhandled resource type "+resource.getClass().getName());
7036    }
7037  }
7038
7039  protected void composeResource(String name, Resource resource) throws IOException {
7040    if (name == null) {
7041      throw new IOException("name == null");
7042    } else if (resource == null) {
7043      throw new IOException("resource == null");
7044      
7045    } else {
7046      throw new Error("Unhandled resource type "+resource.getClass().getName());
7047    }
7048  }
7049
7050  protected void composeType(String prefix, DataType type) throws IOException {
7051    if (prefix == null) {
7052      throw new IOException("prefix == null");
7053    } else if (type == null) {
7054      throw new IOException("type == null");
7055
7056    } else if (type instanceof CodeType) {
7057       composeCode(prefix+"Code", (CodeType) type);
7058    } else if (type instanceof OidType) {
7059       composeOid(prefix+"Oid", (OidType) type);
7060    } else if (type instanceof CanonicalType) {
7061       composeCanonical(prefix+"Canonical", (CanonicalType) type);
7062    } else if (type instanceof UuidType) {
7063       composeUuid(prefix+"Uuid", (UuidType) type);
7064    } else if (type instanceof UrlType) {
7065       composeUrl(prefix+"Url", (UrlType) type);
7066    } else if (type instanceof UnsignedIntType) {
7067       composeUnsignedInt(prefix+"UnsignedInt", (UnsignedIntType) type);
7068    } else if (type instanceof MarkdownType) {
7069       composeMarkdown(prefix+"Markdown", (MarkdownType) type);
7070    } else if (type instanceof IdType) {
7071       composeId(prefix+"Id", (IdType) type);
7072    } else if (type instanceof PositiveIntType) {
7073       composePositiveInt(prefix+"PositiveInt", (PositiveIntType) type);
7074    } else if (type instanceof DateType) {
7075       composeDate(prefix+"Date", (DateType) type);
7076    } else if (type instanceof DateTimeType) {
7077       composeDateTime(prefix+"DateTime", (DateTimeType) type);
7078    } else if (type instanceof StringType) {
7079       composeString(prefix+"String", (StringType) type);
7080    } else if (type instanceof IntegerType) {
7081      composeInteger(prefix+"Integer", (IntegerType) type);
7082    } else if (type instanceof Integer64Type) {
7083      composeInteger64(prefix+"Integer64", (Integer64Type) type);
7084    } else if (type instanceof UriType) {
7085       composeUri(prefix+"Uri", (UriType) type);
7086    } else if (type instanceof InstantType) {
7087       composeInstant(prefix+"Instant", (InstantType) type);
7088    } else if (type instanceof BooleanType) {
7089       composeBoolean(prefix+"Boolean", (BooleanType) type);
7090    } else if (type instanceof Base64BinaryType) {
7091       composeBase64Binary(prefix+"Base64Binary", (Base64BinaryType) type);
7092    } else if (type instanceof TimeType) {
7093       composeTime(prefix+"Time", (TimeType) type);
7094    } else if (type instanceof DecimalType) {
7095       composeDecimal(prefix+"Decimal", (DecimalType) type);
7096    } else {
7097      throw new Error("Unhandled type "+type.fhirType());
7098    }
7099  }
7100
7101}