void WriteXml(XmlWriter writer, ExtractEntityContent content) { EhrExtract.EhrExtractContent ehrContent = content as EhrExtract.EhrExtractContent; if (ehrContent != null) { WriteXml(writer, ehrContent); } else { throw new NotImplementedException("ExtractEntityContent sub-type not implemented: " + content.GetType().ToString()); } }
void ReadXml(XmlReader reader, EhrExtract.EhrExtractContent content) { reader.ReadStartElement(); reader.MoveToContent(); // TODO: <xs:element name="ehr_access" type="X_VERSIONED_OBJECT" minOccurs="0"/> if (reader.Name == "ehr_access") { throw new NotImplementedException("ehr_access not implemented"); } // <xs:element name="ehr_status" type="X_VERSIONED_OBJECT" minOccurs="0"/> if (reader.Name == "ehr_status") { content.EhrStatus = new XmlSerializableXVersionedObject <EhrStatus>(); ReadXml <EhrStatus>(reader, content.EhrStatus); } // TODO: <xs:element name="directory" type="X_VERSIONED_OBJECT" minOccurs="0"/> if (reader.Name == "directory") { throw new NotImplementedException("directory not implemented"); } // <xs:element name="compositions" type="X_VERSIONED_OBJECT" minOccurs="0" maxOccurs="unbounded"/> if (reader.Name == "compositions") { content.Compositions = new OpenEhr.AssumedTypes.List <XVersionedObject <OpenEhr.RM.Composition.Composition> >(); } while (reader.NodeType == System.Xml.XmlNodeType.Element && reader.Name == "compositions") { XmlSerializableXVersionedObject <OpenEhr.RM.Composition.Composition> versionedComposition = new XmlSerializableXVersionedObject <OpenEhr.RM.Composition.Composition>(); ReadXml <OpenEhr.RM.Composition.Composition>(reader, versionedComposition); content.Compositions.Add(versionedComposition); } // TODO: <xs:element name="demographics" type="X_VERSIONED_OBJECT" minOccurs="0" maxOccurs="unbounded"/> if (reader.Name == "demographics") { throw new NotImplementedException("demographics not implemented"); } // <xs:element name="other_items" type="X_VERSIONED_OBJECT" minOccurs="0" maxOccurs="unbounded"/> if (reader.Name == "other_items") { throw new NotImplementedException("other_items not implemented"); } reader.ReadEndElement(); reader.MoveToContent(); }
void WriteXml(XmlWriter writer, EhrExtract.EhrExtractContent content) { WriteXmlBase(writer, content, "EHR_EXTRACT_CONTENT"); // TODO: <xs:element name="ehr_access" type="X_VERSIONED_OBJECT" minOccurs="0"/> // <xs:element name="ehr_status" type="X_VERSIONED_OBJECT" minOccurs="0"/> if (content.EhrStatus != null) { writer.WriteStartElement("ehr_status", RmXmlSerializer.OpenEhrNamespace); this.WriteXml(writer, content.EhrStatus); writer.WriteEndElement(); } // TODO: <xs:element name="directory" type="X_VERSIONED_OBJECT" minOccurs="0"/> // <xs:element name="compositions" type="X_VERSIONED_OBJECT" minOccurs="0" maxOccurs="unbounded"/> if (content.Compositions != null) { foreach (XVersionedObject <Composition.Composition> versionedComposition in content.Compositions) { writer.WriteStartElement("compositions", RmXmlSerializer.OpenEhrNamespace); this.WriteXml(writer, versionedComposition); writer.WriteEndElement(); } } // TODO: <xs:element name="demographics" type="X_VERSIONED_OBJECT" minOccurs="0" maxOccurs="unbounded"/> // <xs:element name="other_items" type="X_VERSIONED_OBJECT" minOccurs="0" maxOccurs="unbounded"/> if (content.OtherItems != null) { foreach (XVersionedObject <RM.Common.Archetyped.Impl.Locatable> versionedObject in content.OtherItems) { writer.WriteStartElement("other_items", RmXmlSerializer.OpenEhrNamespace); this.WriteXml(writer, versionedObject); writer.WriteEndElement(); } } }