Exemplo n.º 1
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "items")
            {
                LocatableList <Element> items = new LocatableList <Element>();

                do
                {
                    Element element = new Element();
                    element.ReadXml(reader);
                    element.Parent = this;
                    items.Add(element);
                    // Added checking on reader.NodeType == Element is because ItemList xml instance
                    // is something like: <items> <items xsi:type='ELEMENT'>..</items></items>.
                    // After reading all element contents, the reader.LocalName is still items,
                    // but the reader NodeType is EndElement. This situation is similar as Section, ItemTable
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }

            reader.MoveToContent();
        }
Exemplo n.º 2
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.LocalName == "folders")
            {
                LocatableList <Folder> folders = new LocatableList <Folder>();
                do
                {
                    Folder folder = new Folder();

                    folder.ReadXml(reader);

                    folder.Parent = this;
                    folders.Add(folder);
                } while (reader.LocalName == "folders" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.folders = folders;
            }

            if (reader.LocalName == "items")
            {
                AssumedTypes.List <ObjectRef> items = new AssumedTypes.List <ObjectRef>();
                do
                {
                    ObjectRef item = new ObjectRef();

                    item.ReadXml(reader);
                    items.Add(item);
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }
        }
Exemplo n.º 3
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            // CM: 21/08/09 This code doesn't support a section without items.
            // e.g.

            /** <items xsi:type="SECTION" archetype_node_id="at0002">
             *   <name>
             *     <value>Mother</value>
             *    </name>
             *  </items>
             *
             * <items xsi:type="SECTION" archetype_node_id="at0002">
             *   <name>
             *     <value>Mother</value>
             *    </name>
             *      <items/>
             *  </items>
             * */
            if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.LocalName == "items")
            {
                if (reader.IsEmptyElement)
                {
                    reader.Skip();
                }
                else
                {
                    LocatableList <ContentItem> items = new LocatableList <ContentItem>();
                    do
                    {
                        string      itemType    = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                        ContentItem contentItem = ContentItem.GetLocatableObjectByType(itemType)
                                                  as ContentItem;
                        if (contentItem == null)
                        {
                            throw new InvalidOperationException("itemType must be type of ContentItem: " + itemType);
                        }

                        contentItem.ReadXml(reader);
                        contentItem.Parent = this;
                        items.Add(contentItem);
                    } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                    this.items = items;
                }
            }
        }
Exemplo n.º 4
0
        protected override void ReadXmlBase(XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "rows")
            {
                LocatableList <Representation.Cluster> rows =
                    new LocatableList <OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster>();

                while (reader.LocalName == "rows")
                {
                    OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster aCluster =
                        new OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster();
                    aCluster.ReadXml(reader);
                    aCluster.Parent = this;
                    rows.Add(aCluster);
                }
                this.rows = rows;
            }
        }
Exemplo n.º 5
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            // TODO: CM: 09/07/09 need to disable this assertion check when EhrTypes is not used
            // in deserialization since TDS origin is optional. When the origin is not existing in
            // openEHR instance, need to get the origin by CalculatOrigin function. At the moment,
            // TddTransformer still uses EhrTypes for the deserialization.
            DesignByContract.Check.Assert(reader.LocalName == "origin",
                                          "Expected LocalName is 'origin', but it is " + reader.LocalName);

            // HKF: 7 Aug 2009 - need to allow origin to be nil for TDD and EhrGateDataObjects transformation prior to OperationalTemplate augmentation
            if (reader.HasAttributes && reader.GetAttribute("nil", RmXmlSerializer.XsiNamespace) == "true")
            {
                // leave origin as null and skip
                reader.Skip();
            }
            else
            {
                this.origin = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
                this.origin.ReadXml(reader);
            }

            if (reader.LocalName == "period")
            {
                this.period = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDuration();
                this.period.ReadXml(reader);
            }

            if (reader.LocalName == "duration")
            {
                this.duration = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDuration();
                this.duration.ReadXml(reader);
            }

            if (reader.LocalName == "events")
            {
                LocatableList <Event <ItemStructure.ItemStructure> > events =
                    new LocatableList <Event <OpenEhr.RM.DataStructures.ItemStructure.ItemStructure> >();
                do
                {
                    string eventType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

                    Event <ItemStructure.ItemStructure> anEvent =
                        OpenEhr.RM.Common.Archetyped.Impl.Locatable.GetLocatableObjectByType(eventType)
                        as Event <ItemStructure.ItemStructure>;
                    if (anEvent == null)
                    {
                        throw new InvalidOperationException("anEvent must not be null.");
                    }
                    anEvent.ReadXml(reader);

                    anEvent.Parent = this;
                    events.Add(anEvent);
                } while (reader.LocalName == "events");

                this.events = events as AssumedTypes.List <Event <T> >;
            }

            if (reader.LocalName == "summary")
            {
                string summaryType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                this.summary = Locatable.GetLocatableObjectByType(summaryType) as ItemStructure.ItemStructure;
                if (this.summary == null)
                {
                    throw new InvalidOperationException("History summary type must be type of ItemStructure: " + summaryType);
                }
                this.summary.ReadXml(reader);
                this.summary.Parent = this;
            }
        }
Exemplo n.º 6
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            // CM: 21/08/09 This code doesn't support a section without items.
            // e.g.
            /** <items xsi:type="SECTION" archetype_node_id="at0002">
                 <name>
                   <value>Mother</value>
                  </name>
                </items>
             *
             * <items xsi:type="SECTION" archetype_node_id="at0002">
                 <name>
                   <value>Mother</value>
                  </name>
             *      <items/>
                </items>
             * */
            if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.LocalName == "items")
            {
                if (reader.IsEmptyElement)
                    reader.Skip();
                else
                {
                    LocatableList<ContentItem> items = new LocatableList<ContentItem>();
                    do
                    {
                        string itemType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                        ContentItem contentItem = ContentItem.GetLocatableObjectByType(itemType)
                            as ContentItem;
                        if (contentItem == null)
                            throw new InvalidOperationException("itemType must be type of ContentItem: " + itemType);

                        contentItem.ReadXml(reader);
                        contentItem.Parent = this;
                        items.Add(contentItem);

                    } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                    this.items = items;
                }
            }
        }
Exemplo n.º 7
0
        protected override void ReadXmlBase(XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "rows")
            {
                LocatableList<Representation.Cluster> rows =
                    new LocatableList<OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster>();

                while (reader.LocalName == "rows")
                {
                    OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster aCluster =
                       new OpenEhr.RM.DataStructures.ItemStructure.Representation.Cluster();
                    aCluster.ReadXml(reader);
                    aCluster.Parent = this;
                    rows.Add(aCluster);
                }
                this.rows = rows;
            }
        }
Exemplo n.º 8
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.LocalName == "items")
            {
                LocatableList<Element> items = new LocatableList<Element>();

                do
                {
                    Element element = new Element();
                    element.ReadXml(reader);
                    element.Parent = this;
                    items.Add(element);
                // Added checking on reader.NodeType == Element is because ItemList xml instance
                // is something like: <items> <items xsi:type='ELEMENT'>..</items></items>.
                // After reading all element contents, the reader.LocalName is still items,
                // but the reader NodeType is EndElement. This situation is similar as Section, ItemTable
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }

            reader.MoveToContent();
        }
Exemplo n.º 9
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            if (reader.NodeType == System.Xml.XmlNodeType.Element && reader.LocalName == "folders")
            {
                LocatableList<Folder> folders = new LocatableList<Folder>();
                do
                {
                    Folder folder = new Folder();

                    folder.ReadXml(reader);

                    folder.Parent = this;
                    folders.Add(folder);
                } while (reader.LocalName == "folders" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.folders = folders;
            }

            if (reader.LocalName == "items")
            {
                AssumedTypes.List<ObjectRef> items = new AssumedTypes.List<ObjectRef>();
                do
                {
                    ObjectRef item = new ObjectRef();

                    item.ReadXml(reader);
                    items.Add(item);
                } while (reader.LocalName == "items" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.items = items;
            }
        }