private void ReadTAttribute(XmlReader reader, TAttribute attribute)
        {
            Check.Require(attribute != null);

            reader.ReadStartElement(); // attributes
            reader.MoveToContent();

            // Read rm_attribute_name
            Check.Assert(reader.LocalName == "rm_attribute_name");
            attribute.RmAttributeName = reader.ReadElementContentAsString();
            reader.MoveToContent();

            // Read children
            Check.Assert(reader.LocalName == "children", "Expected at least one child in T_ATTRIBUTE");
            attribute.Children = new List <TComplexObject>();
            while (reader.LocalName == "children")
            {
                TComplexObject tComplexObject = new TComplexObject();
                ReadTComplexObject(reader, tComplexObject);
                attribute.Children.Add(tComplexObject);
                reader.ReadEndElement();
                reader.MoveToContent();
            }

            // Read differential path
            Check.Assert(reader.LocalName == "differential_path");
            attribute.DifferentialPath = reader.ReadElementContentAsString();
        }
Exemple #2
0
        private void WriteTAttribute(XmlWriter writer, TAttribute attribute)
        {
            Check.Require(attribute != null);

            writer.WriteElementString("rm_attribute_name", attribute.RmAttributeName);
            foreach (TComplexObject tComplexObject in attribute.Children)
            {
                writer.WriteStartElement(UseOpenEhrPrefix(writer), "children", OpenEhrNamespace);
                WriteTComplexObject(writer, tComplexObject);
                writer.WriteEndElement();
            }
            writer.WriteElementString("differential_path", attribute.DifferentialPath);
        }
        private void ReadTConstraint(XmlReader reader, TConstraint constraints)
        {
            Check.Require(constraints != null, string.Format(CommonStrings.XMustNotBeNull, "constraints"));
            List <TAttribute> attributeList = new List <TAttribute>();

            reader.ReadStartElement(); // constraints
            reader.MoveToContent();

            while (reader.LocalName == "attributes")
            {
                TAttribute attribute = new TAttribute();
                ReadTAttribute(reader, attribute);
                attributeList.Add(attribute);
                reader.MoveToContent();
                reader.ReadEndElement();
                reader.MoveToContent();
            }

            constraints.Attributes = attributeList;
        }
        private void WriteTAttribute(XmlWriter writer, TAttribute attribute)
        {
            Check.Require(attribute != null);

            writer.WriteElementString("rm_attribute_name", attribute.RmAttributeName);
            foreach (TComplexObject tComplexObject in attribute.Children)
            {
                writer.WriteStartElement(UseOpenEhrPrefix(writer), "children", OpenEhrNamespace);
                WriteTComplexObject(writer, tComplexObject);
                writer.WriteEndElement();
            }
            writer.WriteElementString("differential_path", attribute.DifferentialPath);
        }