コード例 #1
0
        void WriteXmlBase(XmlWriter writer, ExtractLocatable locatable)
        {
            // <xs:attribute name="archetype_node_id" type="archetypeNodeId" use="required"/>
            writer.WriteAttributeString("archetype_node_id", locatable.ArchetypeNodeId);

            //<xs:element name="name" type="DV_TEXT"/>
            writer.WriteStartElement("name", RmXmlSerializer.OpenEhrNamespace);
            RmXmlSerializer.WriteXml(writer, locatable.Name);
            writer.WriteEndElement();

            //<xs:element name="uid" type="UID_BASED_ID" minOccurs="0"/>
            if (locatable.Uid != null)
            {
                writer.WriteStartElement("uid", RmXmlSerializer.OpenEhrNamespace);
                RmXmlSerializer.WriteXml(writer, locatable.Uid);
                writer.WriteEndElement();
            }

            //<xs:element name="links" type="LINK" minOccurs="0" maxOccurs="unbounded"/>
            if (locatable.Links != null)
            {
                foreach (Link link in locatable.Links)
                {
                    writer.WriteStartElement("links", RmXmlSerializer.OpenEhrNamespace);
                    ((System.Xml.Serialization.IXmlSerializable)link).WriteXml(writer);
                    writer.WriteEndElement();
                }
            }

            //<xs:element name="archetype_details" type="ARCHETYPED" minOccurs="0"/>
            if (locatable.ArchetypeDetails != null)
            {
                writer.WriteStartElement("archetype_details", RmXmlSerializer.OpenEhrNamespace);
                ((System.Xml.Serialization.IXmlSerializable)locatable.ArchetypeDetails).WriteXml(writer);
                writer.WriteEndElement();
            }

            //<xs:element name="feeder_audit" type="FEEDER_AUDIT" minOccurs="0"/>
            if (locatable.FeederAudit != null)
            {
                writer.WriteStartElement("feeder_audit", RmXmlSerializer.OpenEhrNamespace);
                ((System.Xml.Serialization.IXmlSerializable)locatable.FeederAudit).WriteXml(writer);
                writer.WriteEndElement();
            }
        }
コード例 #2
0
        public void WriteXml <T>(XmlWriter writer, XVersionedObject <T> versionedObject) where T : class
        {
            // <xs:element name="uid" type="HIER_OBJECT_ID"/>
            writer.WriteStartElement("uid", RmXmlSerializer.OpenEhrNamespace);
            ((System.Xml.Serialization.IXmlSerializable)versionedObject.Uid).WriteXml(writer);
            writer.WriteEndElement();

            //<xs:element name="owner_id" type="OBJECT_REF"/>
            writer.WriteStartElement("owner_id", RmXmlSerializer.OpenEhrNamespace);
            RmXmlSerializer.WriteXml(writer, versionedObject.OwnerId);
            writer.WriteEndElement();

            // <xs:element name="time_created" type="DV_DATE_TIME"/>
            writer.WriteStartElement("time_created", RmXmlSerializer.OpenEhrNamespace);
            ((System.Xml.Serialization.IXmlSerializable)versionedObject.TimeCreated).WriteXml(writer);
            writer.WriteEndElement();

            //<xs:element name="total_version_count" type="xs:int"/>
            writer.WriteStartElement("total_version_count", RmXmlSerializer.OpenEhrNamespace);
            writer.WriteValue(versionedObject.TotalVersionCount);
            writer.WriteEndElement();

            //<xs:element name="extract_version_count" type="xs:int"/>
            writer.WriteStartElement("extract_version_count", RmXmlSerializer.OpenEhrNamespace);
            writer.WriteValue(versionedObject.ExtractVersionCount);
            writer.WriteEndElement();

            // TODO: <xs:element name="revision_history" type="REVISION_HISTORY" minOccurs="0"/>

            //<xs:element name="versions" type="ORIGINAL_VERSION" minOccurs="0" maxOccurs="unbounded"/>
            if (versionedObject.Versions != null)
            {
                foreach (OriginalVersion <T> version in versionedObject.Versions)
                {
                    writer.WriteStartElement("versions", RmXmlSerializer.OpenEhrNamespace);
                    ((System.Xml.Serialization.IXmlSerializable)version).WriteXml(writer);
                    writer.WriteEndElement();
                }
            }
        }