protected override void ReadXmlBase(System.Xml.XmlReader reader) { base.ReadXmlBase(reader); Check.Assert(reader.LocalName == "language", "Expected LocalName is 'language' rather than " + reader.LocalName); this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.language.ReadXml(reader); Check.Assert(reader.LocalName == "encoding", "Expected LocalName is 'encoding' rather than " + reader.LocalName); this.encoding = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.encoding.ReadXml(reader); Check.Assert(reader.LocalName == "subject", "Expected LocalName is 'subject' rather than " + reader.LocalName); string subjectType = RmXmlSerializer.ReadXsiType(reader); this.subject = RmFactory.PartyProxy(subjectType); this.subject.ReadXml(reader); if (reader.LocalName == "provider") { string providerType = RmXmlSerializer.ReadXsiType(reader); this.provider = RmFactory.PartyProxy(providerType); this.provider.ReadXml(reader); } if (reader.LocalName == "other_participations") { this.otherParticipations = new OpenEhr.AssumedTypes.List <Participation>(); do { Participation p = new Participation(); p.ReadXml(reader); this.otherParticipations.Add(p); } while (reader.LocalName == "other_participations"); } if (reader.LocalName == "work_flow_id") { string workFlowIdType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace); // CM: 06/09/10 when workFlowIdType is null or empty, it's type of OBJECT_REF if (string.IsNullOrEmpty(workFlowIdType)) { this.workflowId = new ObjectRef(); } else { this.workflowId = ObjectRef.GetObjectRefByType(workFlowIdType); } this.workflowId.ReadXml(reader); } }
protected override void ReadXmlBase(System.Xml.XmlReader reader) { base.ReadXmlBase(reader); DesignByContract.Check.Assert(reader.LocalName == "language", "Expected LocalName is 'language', but it is " + reader.LocalName); this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.language.ReadXml(reader); DesignByContract.Check.Assert(reader.LocalName == "territory", "Expected LocalName is 'territory', but it is " + reader.LocalName); this.territory = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.territory.ReadXml(reader); DesignByContract.Check.Assert(reader.LocalName == "category", "Expected LocalName is 'category', but it is " + reader.LocalName); this.category = new OpenEhr.RM.DataTypes.Text.DvCodedText(); this.category.ReadXml(reader); DesignByContract.Check.Assert(reader.LocalName == "composer", "Expected LocalName is 'composer', but it is " + reader.LocalName); string composerType = RmXmlSerializer.ReadXsiType(reader); this.composer = RmFactory.PartyProxy(composerType); this.composer.ReadXml(reader); if (reader.LocalName == "context") { this.context = new EventContext(); this.context.ReadXml(reader); this.context.Parent = this; } if (reader.LocalName == "content") { OpenEhr.AssumedTypes.Impl.LocatableList <ContentItem> contents = new OpenEhr.AssumedTypes.Impl.LocatableList <ContentItem>(); do { string contentType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace); Check.Assert(!string.IsNullOrEmpty(contentType), "content type must not be null or empty."); ContentItem aContentItem = ContentItem.GetLocatableObjectByType(contentType) as ContentItem; if (aContentItem == null) { throw new InvalidOperationException("Composition contentType must be type of ContentItem: " + contentType); } aContentItem.ReadXml(reader); aContentItem.Parent = this; contents.Add(aContentItem); } while (reader.LocalName == "content" && reader.NodeType == System.Xml.XmlNodeType.Element); this.content = contents; } }
protected override void ReadXmlBase(System.Xml.XmlReader reader) { base.ReadXmlBase(reader); if (reader.LocalName == "attested_view") { this.attestedView = new OpenEhr.RM.DataTypes.Encapsulated.DvMultimedia(); this.attestedView.ReadXml(reader); } if (reader.LocalName == "proof") { this.proof = reader.ReadElementString("proof", RmXmlSerializer.OpenEhrNamespace); reader.MoveToContent(); } if (reader.LocalName == "items") { this.items = new OpenEhr.AssumedTypes.List <OpenEhr.RM.DataTypes.Uri.DvEhrUri>(); do { DataTypes.Uri.DvEhrUri uri = new OpenEhr.RM.DataTypes.Uri.DvEhrUri(); uri.ReadXml(reader); this.items.Add(uri); } while (reader.LocalName == "items"); } if (reader.LocalName != "reason") { throw new ValidationException("Excepted element name is reason, but it is: " + reader.LocalName); } string reasonType = RmXmlSerializer.ReadXsiType(reader); if (!string.IsNullOrEmpty(reasonType)) { this.reason = RmFactory.DataValue(reasonType) as DataTypes.Text.DvText; } else { this.reason = new OpenEhr.RM.DataTypes.Text.DvText(); } this.reason.ReadXml(reader); if (reader.LocalName != "is_pending") { throw new ValidationException("Excepted element name is is_pending, but it is: " + reader.LocalName); } this.isPending = reader.ReadElementContentAsBoolean("is_pending", RmXmlSerializer.OpenEhrNamespace); reader.MoveToContent(); }
protected override void ReadXmlBase(System.Xml.XmlReader reader) { if (reader.LocalName == "lower") { string type = RmXmlSerializer.ReadXsiType(reader); this.lower = RmFactory.DataValue(type) as T; Check.Assert(this.lower != null, "lower must not be null"); this.lower.ReadXml(reader); reader.MoveToContent(); } if (reader.LocalName == "upper") { string type = RmXmlSerializer.ReadXsiType(reader); this.upper = RmFactory.DataValue(type) as T; Check.Assert(this.upper != null, "lower must not be null"); this.upper.ReadXml(reader); reader.MoveToContent(); } if (reader.LocalName == "lower_included") { this.lowerIncluded = reader.ReadElementContentAsBoolean(); this.lowerIncludedSet = true; reader.MoveToContent(); } if (reader.LocalName == "upper_included") { this.upperIncluded = reader.ReadElementContentAsBoolean(); this.upperIncludedSet = true; reader.MoveToContent(); } Check.Assert(reader.LocalName == "lower_unbounded", "localName must be 'lower_unbounded'"); this.lowerUnbounded = reader.ReadElementContentAsBoolean(); this.lowerUnboundedSet = true; reader.MoveToContent(); Check.Assert(reader.LocalName == "upper_unbounded", "localName must be 'upper_unbounded'"); this.upperUnbounded = reader.ReadElementContentAsBoolean(); this.upperUnboundedSet = true; reader.MoveToContent(); CheckInvariants(); }
internal void ReadXml(System.Xml.XmlReader reader) { reader.ReadStartElement(); reader.MoveToContent(); Check.Require(reader.LocalName == "system_id", "Expected LocalName is 'system_id' rather than " + reader.LocalName); this.systemId = reader.ReadElementString("system_id", RmXmlSerializer.OpenEhrNamespace); if (reader.LocalName == "location") { this.location = new OpenEhr.RM.Common.Generic.PartyIdentified(); this.location.ReadXml(reader); } if (reader.LocalName == "provider") { this.provider = new OpenEhr.RM.Common.Generic.PartyIdentified(); this.provider.ReadXml(reader); } if (reader.LocalName == "subject") { string subjectType = RmXmlSerializer.ReadXsiType(reader); Check.Assert(!string.IsNullOrEmpty(subjectType), "the type of subject must not be null or empty."); this.subject = RmFactory.PartyProxy(subjectType); this.subject.ReadXml(reader); } if (reader.LocalName == "time") { this.time = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime(); this.time.ReadXml(reader); } if (reader.LocalName == "version_id") { this.versionId = reader.ReadElementString("version_id", RmXmlSerializer.OpenEhrNamespace); } if (!reader.IsStartElement()) { reader.ReadEndElement(); } reader.MoveToContent(); }
internal void ReadXml(XmlReader reader) { reader.ReadStartElement(); reader.MoveToContent(); Check.Assert(reader.LocalName == "function", "Expected LocalName is 'function' not " + reader.LocalName); string functionType = RmXmlSerializer.ReadXsiType(reader); if (!string.IsNullOrEmpty(functionType)) { this.function = RmFactory.DataValue(functionType) as DataTypes.Text.DvText; } else { this.function = new OpenEhr.RM.DataTypes.Text.DvText(); } this.function.ReadXml(reader); reader.MoveToContent(); Check.Assert(reader.LocalName == "performer", "Expected LocalName is 'performer' not " + reader.LocalName); string performerType = RmXmlSerializer.ReadXsiType(reader); this.performer = RmFactory.PartyProxy(performerType); this.performer.ReadXml(reader); if (reader.LocalName == "time") { this.time = new OpenEhr.RM.DataTypes.Quantity.DvInterval <OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime>(); this.time.ReadXml(reader); } Check.Assert(reader.LocalName == "mode", "Expected LocalName is 'mode' not " + reader.LocalName); this.mode = new OpenEhr.RM.DataTypes.Text.DvCodedText(); this.mode.ReadXml(reader); DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement, "Expected endElement of PartyIdentified."); reader.ReadEndElement(); reader.MoveToContent(); }
public static DataValue ReadDataValue(System.Xml.XmlReader reader) { DataValue dataValue = null; string valueType = RmXmlSerializer.ReadXsiType(reader); Check.Assert(!string.IsNullOrEmpty(valueType), "value type must not be null or empty."); switch (valueType) { case "DV_INTERVAL": reader.ReadStartElement(); reader.MoveToContent(); if (reader.LocalName != "lower" && reader.LocalName != "upper") { throw new ApplicationException("interval must have lower or upper element"); } string intervalType = RmXmlSerializer.ReadXsiType(reader); dataValue = CreateInterval(intervalType); dataValue.ReadXmlBase(reader); DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement, "Expected endElement after calling ReadXml"); reader.ReadEndElement(); reader.MoveToContent(); break; default: dataValue = RmFactory.DataValue(valueType); dataValue.ReadXml(reader); break; } DesignByContract.Check.Ensure(dataValue != null, "dataValue must not be null."); return(dataValue); }
protected virtual void ReadXmlBase(System.Xml.XmlReader reader) { Check.Assert(reader.LocalName == "system_id", "Expected LocalName is 'system_id' not " + reader.LocalName); this.systemId = reader.ReadElementString("system_id", RmXmlSerializer.OpenEhrNamespace); reader.MoveToContent(); Check.Assert(reader.LocalName == "committer", "Expected LocalName is 'committer' not " + reader.LocalName); string committerType = RmXmlSerializer.ReadXsiType(reader); this.committer = RmFactory.PartyProxy(committerType); this.committer.ReadXml(reader); Check.Assert(reader.LocalName == "time_committed", "Expected LocalName is 'time_committed' not " + reader.LocalName); this.timeCommitted = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime(); this.timeCommitted.ReadXml(reader); Check.Assert(reader.LocalName == "change_type", "Expected LocalName is 'change_type' not " + reader.LocalName); this.changeType = new OpenEhr.RM.DataTypes.Text.DvCodedText(); this.changeType.ReadXml(reader); if (reader.LocalName == "description") { string descriptionType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace); if (descriptionType == null) { this.description = new OpenEhr.RM.DataTypes.Text.DvText(); } else { this.description = new OpenEhr.RM.DataTypes.Text.DvCodedText(); } this.description.ReadXml(reader); } }
internal void ReadXml(System.Xml.XmlReader reader) { reader.ReadStartElement(); reader.MoveToContent(); Check.Assert(reader.LocalName == "meaning", "Expected LocalName is meaning rather than " + reader.LocalName); if (this.meaning == null) { string meaningType = RmXmlSerializer.ReadXsiType(reader); if (meaningType == null) { this.meaning = new DvText(); } else { this.meaning = RmFactory.DataValue(meaningType) as DvText; } } this.meaning.ReadXml(reader); DesignByContract.Check.Assert(reader.LocalName == "range", "Expected LocalName is range rather than " + reader.LocalName); if (this.range == null) { this.range = new DvInterval <T>(); } this.range.ReadXml(reader); if (!reader.IsStartElement()) { reader.ReadEndElement(); } reader.MoveToContent(); this.CheckInvariants(); }
protected virtual void ReadXmlBase(System.Xml.XmlReader reader) { Check.Assert(reader.LocalName == "name", "Expected LocalName is 'name' rather than " + reader.LocalName); // %HYYKA% // CM: 12/11/09 need to take into account prefix //string nameType = reader.GetAttribute("type", XmlSerializer.XsiNamespace); string nameType = RmXmlSerializer.ReadXsiType(reader); if (nameType != null && nameType == "DV_CODED_TEXT") { this.name = new DvCodedText(); } else { this.name = new DvText(); } this.name.ReadXml(reader); if (reader.LocalName == "uid") { string uidType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace); int i = uidType.IndexOf(":"); if (i > 0) { uidType = uidType.Substring(i + 1); } if (uidType == "OBJECT_VERSION_ID") { this.uid = new ObjectVersionId(); } else if (uidType == "HIER_OBJECT_ID") { this.uid = new HierObjectId(); } this.uid.ReadXml(reader); } if (reader.LocalName == "links") { this.links = new OpenEhr.AssumedTypes.List <Link>(); do { Link aLink = new Link(); aLink.ReadXml(reader); this.links.Add(aLink); } while (reader.LocalName == "links" && reader.NodeType == System.Xml.XmlNodeType.Element); } if (reader.LocalName == "archetype_details") { this.archetypeDetails = new Archetyped(); this.archetypeDetails.ReadXml(reader); } if (reader.LocalName == "feeder_audit") { this.feederAudit = new FeederAudit(); this.feederAudit.ReadXml(reader); } }
void ReadXmlBase(XmlReader reader, ExtractLocatable locatable) { reader.MoveToContent(); locatable.ArchetypeNodeId = reader.GetAttribute("archetype_node_id"); Check.Require(!string.IsNullOrEmpty(locatable.ArchetypeNodeId), "archetype_node_id attribute is required"); reader.ReadStartElement(); reader.MoveToContent(); Check.Assert(reader.LocalName == "name", "Expected LocalName is 'name' rather than " + reader.LocalName); string nameType = RmXmlSerializer.ReadXsiType(reader); if (nameType != null && nameType == "DV_CODED_TEXT") { locatable.Name = new DvCodedText(); } else { locatable.Name = new DvText(); } locatable.Name.ReadXml(reader); if (reader.LocalName == "uid") { string uidType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace); int i = uidType.IndexOf(":"); if (i > 0) { uidType = uidType.Substring(i + 1); } if (uidType == "OBJECT_VERSION_ID") { locatable.Uid = new ObjectVersionId(); } else if (uidType == "HIER_OBJECT_ID") { locatable.Uid = new HierObjectId(); } locatable.Uid.ReadXml(reader); } if (reader.LocalName == "links") { locatable.Links = new OpenEhr.AssumedTypes.List <Link>(); do { Link aLink = new Link(); aLink.ReadXml(reader); locatable.Links.Add(aLink); } while (reader.LocalName == "links" && reader.NodeType == System.Xml.XmlNodeType.Element); } if (reader.LocalName == "archetype_details") { locatable.ArchetypeDetails = new Archetyped(); locatable.ArchetypeDetails.ReadXml(reader); } if (reader.LocalName == "feeder_audit") { locatable.FeederAudit = new FeederAudit(); locatable.FeederAudit.ReadXml(reader); } }