Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        public void ReadXml(XmlReader reader, Extract extract)
        {
            // <xs:extension base="LOCATABLE">
            this.ReadXmlBase(reader, extract as ExtractLocatable);

            // <xs:element name="request_id" type="OBJECT_REF" minOccurs="0"/>
            if (reader.LocalName == "request_id")
            {
                if (reader.HasAttributes)
                {
                    throw new NotSupportedException("subtype of OBJECT_REF not supported in request_id");
                }

                extract.RequestId = new ObjectRef();
                extract.RequestId.ReadXml(reader);
            }

            // <xs:element name="time_created" type="DV_DATE_TIME"/>
            Check.Require(reader.LocalName == "time_created", "time_created is mandatory");
            extract.TimeCreated = new DvDateTime();
            extract.TimeCreated.ReadXml(reader);

            // <xs:element name="system_id" type="HIER_OBJECT_ID"/>
            Check.Require(reader.LocalName == "system_id", "system_id is mandatory");
            extract.SystemId = new HierObjectId();
            extract.SystemId.ReadXml(reader);

            // <xs:element name="partitipations" type="PARTICIPATION" minOccurs="0" maxOccurs="unbounded"/>
            if (reader.Name == "partitipations")
            {
                extract.Participations = new OpenEhr.AssumedTypes.List <Participation>();
            }
            while (reader.NodeType == System.Xml.XmlNodeType.Element && reader.Name == "partitipations")
            {
                Participation participation = new Participation();

                participation.ReadXml(reader);
                extract.Participations.Add(participation);
            }

            // <xs:element name="sequence_nr" type="xs:long"/>
            extract.SequenceNr = reader.ReadElementContentAsInt("sequence_nr", RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();

            // <xs:element name="chapters" type="EXTRACT_CHAPTER" minOccurs="0" maxOccurs="unbounded"/>
            if (reader.Name == "chapters")
            {
                extract.Chapters = new OpenEhr.AssumedTypes.List <ExtractChapter>();
            }
            while (reader.NodeType == System.Xml.XmlNodeType.Element && reader.Name == "chapters")
            {
                ExtractChapter chapter = new ExtractChapter();

                this.ReadXml(reader, chapter);
                extract.Chapters.Add(chapter);
            }

            // TODO: <xs:element name="specification" type="EXTRACT_SPEC" minOccurs="0"/>
            if (reader.Name == "specification")
            {
                throw new NotImplementedException("specification not implemented");
            }

            reader.ReadEndElement();
            reader.MoveToContent();
        }