Пример #1
0
 protected override void ReadXmlBase(System.Xml.XmlReader reader)
 {
     Check.Assert(reader.LocalName == "value", "local name must be 'value rather than '" + reader.LocalName);
     this.value = reader.ReadElementContentAsBoolean("value", RmXmlSerializer.OpenEhrNamespace);
     this.valueSet = true;
     reader.MoveToContent();
 }
Пример #2
0
 public static Color readColor(System.Xml.XmlReader reader)
 {
     reader.ReadToDescendant("IsKnownColor");
     bool isKnownColor = reader.ReadElementContentAsBoolean();
     string colorName = reader.ReadElementContentAsString();
     reader.ReadEndElement();
     if (isKnownColor)
         return Color.FromName(colorName);
     else
         return Color.FromArgb(int.Parse(colorName, System.Globalization.NumberStyles.HexNumber));
 }
Пример #3
0
 public override void ReadXml(System.Xml.XmlReader reader)
 {
     // read the LayerItem properties
     base.ReadXml(reader);
     // read the common data of the ruler
     mColor = XmlReadWrite.readColor(reader);
     mLineThickness = reader.ReadElementContentAsFloat();
     mDisplayDistance = reader.ReadElementContentAsBoolean();
     mDisplayUnit = reader.ReadElementContentAsBoolean();
     mGuidelineColor = XmlReadWrite.readColor(reader);
     mGuidelineThickness = XmlReadWrite.readFloat(reader);
     mGuidelineDashPattern = XmlReadWrite.readFloatArray(reader);
     this.CurrentUnit = (Tools.Distance.Unit)(XmlReadWrite.readInteger(reader));
     mMeasureFont = XmlReadWrite.readFont(reader);
     this.MeasureColor = XmlReadWrite.readColor(reader);
     // the update method will be called by the non abstract derivated class
 }
Пример #4
0
 public override void ReadXml(System.Xml.XmlReader reader)
 {
     base.ReadXml(reader);
     // read the data of the ruler (don't use accessor to avoid multiple call to the update functions
     mControlPoint[0].mPoint = XmlReadWrite.readPointF(reader);
     mControlPoint[1].mPoint = XmlReadWrite.readPointF(reader);
     // read the id of the attached brick (if any)
     mControlPoint[0].mAttachedBrickHashCodeUsedDuringLoading = reader.ReadElementContentAsInt();
     mControlPoint[1].mAttachedBrickHashCodeUsedDuringLoading = reader.ReadElementContentAsInt();
     mOffsetDistance = reader.ReadElementContentAsFloat();
     mAllowOffset = reader.ReadElementContentAsBoolean();
     // read the end element of the ruler
     reader.ReadEndElement();
     // update the computing data after reading the 2 points and offset
     updateDisplayDataAndMesurementImage();
 }
Пример #5
0
        public void ReadXml(System.Xml.XmlReader r)
        {
            bool wasEmpty = r.IsEmptyElement;
            if (wasEmpty)
                return;
            _variable = r.GetAttribute("Map");
            r.Read();							//<AddressInstance>
            _startAddress = Convert.ToUInt32(r.ReadElementContentAsString(), 16);
            _X = r.ReadElementContentAsInt();
            _Y = r.ReadElementContentAsInt();
            _mapSize = r.ReadElementContentAsInt();
            _value = r.ReadElementContentAsInt();
            _byteOnCell = r.ReadElementContentAsInt();
            _mapName = r.ReadElementContentAsString();
            _comment = r.ReadElementContentAsString();

            r.Read();
            {									//<FRom>
                _sizeOfCellX = r.ReadElementContentAsInt();
                _sizeOfCellY = r.ReadElementContentAsInt();
                _loColor = (int)Convert.ToUInt32(r.ReadElementContentAsString(), 16);
                _hiColor = (int)Convert.ToUInt32(r.ReadElementContentAsString(), 16);
                _xSatteliteConstName = r.ReadElementContentAsString();
                _ySatteliteConstName = r.ReadElementContentAsString();
                _hide = r.ReadElementContentAsBoolean();
                _flip = r.ReadElementContentAsBoolean();
                _mask = (byte)r.ReadElementContentAsInt();
                _mapView = (ViewEnum)r.ReadElementContentAsInt();
            } r.ReadEndElement();				//</FRom>
            r.ReadEndElement();					//</AddressInstance>
        }
Пример #6
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "value")
                throw new InvalidXmlException("value", reader.LocalName);
            this.Value = new DvCodedText();
            this.Value.ReadXml(reader);

            if (reader.LocalName != "is_terminal")
                throw new InvalidXmlException("is_terminal", reader.LocalName);
            this.IsTerminal = reader.ReadElementContentAsBoolean("is_terminal", RmXmlSerializer.OpenEhrNamespace);
        }
Пример #7
0
 public static bool readBoolean(System.Xml.XmlReader reader)
 {
     return reader.ReadElementContentAsBoolean();
 }
Пример #8
0
 private void readNotListedInLibraryTag(ref System.Xml.XmlReader xmlReader)
 {
     if (!xmlReader.IsEmptyElement)
     {
         bool shouldIgnore = xmlReader.ReadElementContentAsBoolean();
         if (shouldIgnore)
             this.mBrickType |= BrickType.NOT_LISTED;
     }
     else
     {
         xmlReader.Read();
     }
 }
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.</param>
        /// <remarks>Documented by Dev05, 2008-12-01</remarks>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.Read();

            while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                    case "Name":
                        name = reader.ReadElementContentAsString().Trim();
                        break;
                    case "UncPath":
                        connectionString = reader.ReadElementContentAsString().Trim().Replace("%MLMyDocuments%", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
                        connectionString = connectionString.Replace("MEMSTICK:\\", Path.GetPathRoot(Environment.CommandLine.Replace("\"", string.Empty)));
                        break;
                    case "IsDefault":
                        IsDefault = reader.ReadElementContentAsBoolean();
                        break;
                    default:
            #if debug_output
                        Trace.WriteLine("Unknow Connection-Property: " + reader.Name);
            #endif
                        reader.Read();
                        break;
                }
            }

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(connectionString))
                throw new Exception("Invalid connection name or path.");

            reader.ReadEndElement();
        }
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.</param>
        /// <remarks>Documented by Dev05, 2008-11-27</remarks>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            reader.Read();

            while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                    case "Name":
                        name = reader.ReadElementContentAsString().Trim();
                        break;
                    case "Server":
                        server = reader.ReadElementContentAsString().Trim();
                        break;
                    case "Port":
                        port = reader.ReadElementContentAsInt();
                        break;
                    case "UserId":
                        userId = reader.ReadElementContentAsString().Trim();
                        break;
                    case "Password":
                        password = reader.ReadElementContentAsString().Trim();
                        break;
                    case "Ssl":
                        ssl = reader.ReadElementContentAsBoolean();
                        break;
                    case "Database":
                        database = reader.ReadElementContentAsString().Trim();
                        break;
                    case "SyncType":
                        SyncType = (SyncType)Enum.Parse(typeof(SyncType), reader.ReadElementContentAsString().Trim());

                        // [ML-2349]  Deactivate HalfSynchronizedWithDbAccess sync mode
                        if (SyncType == SyncType.HalfSynchronizedWithDbAccess)
                            SyncType = SyncType.HalfSynchronizedWithoutDbAccess;

                        break;
                    case "SyncURI":
                        SyncURI = reader.ReadElementContentAsString().Trim();
                        break;
                    case "MediaURI":
                        MediaURI = reader.ReadElementContentAsString().Trim() + Resources.MediaURI_Suffix;
                        break;
                    case "ExtensionURI":
                        ExtensionURI = reader.ReadElementContentAsString().Trim() + Resources.ExtensionURI_Suffix;
                        break;
                    case "OtherProperties":
                        otherProperties = otherPropertiesSerializer.Deserialize(reader) as SerializableDictionary<string, object>;
                        break;
                    default:
            #if debug_output
                        Trace.WriteLine("Unknow Connection-Property: " + reader.Name);
            #endif
                        reader.Read();
                        break;
                }
            }

            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(server))
                throw new Exception("Invalid connection name or path.");

            reader.ReadEndElement();
        }
Пример #11
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            // reset the counter of modifications because we just load the map (no modification done)
            mNumberOfModificationSinceLastSave = 0;
            // version
            readVersionNumber(reader);
            // check if the BlueBrick program is not too old, that
            // means the user try to load a file generated with
            /// a earlier version of BlueBrick
            if (mDataVersionOfTheFileLoaded > CURRENT_DATA_VERSION)
            {
                MessageBox.Show(null, Properties.Resources.ErrorMsgProgramObsolete,
                    Properties.Resources.ErrorMsgTitleError, MessageBoxButtons.OK,
                    MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return;
            }
            // get the number of layer for the progressbar
            if (mDataVersionOfTheFileLoaded >= 3)
            {
                int nbItems = reader.ReadElementContentAsInt();
                // init the progress bar with the real number of layer items (+1 for the header +1 for the link rebuilding)
                MainForm.Instance.resetProgressBar(nbItems + 2);
            }
            // check is there is a background color
            if (reader.Name.Equals("BackgroundColor"))
                mBackgroundColor = XmlReadWrite.readColor(reader);
            // data of the map
            mAuthor = reader.ReadElementContentAsString();
            mLUG = reader.ReadElementContentAsString();
            mShow = reader.ReadElementContentAsString();
            reader.ReadToDescendant("Day");
            int day = reader.ReadElementContentAsInt();
            int month = reader.ReadElementContentAsInt();
            int year = reader.ReadElementContentAsInt();
            mDate = new DateTime(year, month, day);
            // read the comment if the version is greater than 0
            if (mDataVersionOfTheFileLoaded > 0)
            {
                reader.ReadToFollowing("Comment");
                mComment = reader.ReadElementContentAsString().Replace("\n", Environment.NewLine);
            }
            else
            {
                reader.ReadToFollowing("CurrentSnapGridSize");
            }
            if (mDataVersionOfTheFileLoaded < 2)
            {
                // skip the static data of layers that before we were saving
                // but now I think it is stupid, since we don't have action to change that
                // and we don't have way to update the enabled of the buttons
                reader.ReadElementContentAsFloat(); // CurrentSnapGridSize
                reader.ReadElementContentAsBoolean(); // SnapGridEnabled
                reader.ReadElementContentAsFloat(); // CurrentRotationStep
            }

            // read the export data if the version is 5 or higher
            if (mDataVersionOfTheFileLoaded > 4)
            {
                reader.ReadToDescendant("ExportPath");
                // read the relative export path and store it temporarly in the absolute path variable
                // the absolute path will be computed after the xml serialization is finished
                mExportAbsoluteFileName = reader.ReadElementContentAsString();
                // read the other export info
                mExportFileTypeIndex = reader.ReadElementContentAsInt();
                mExportArea = XmlReadWrite.readRectangleF(reader);
                mExportScale = reader.ReadElementContentAsFloat();
                // read even more info from version 8
                if (mDataVersionOfTheFileLoaded > 7)
                {
                    mExportWatermark = XmlReadWrite.readBoolean(reader);
                    mExportBrickHull = XmlReadWrite.readBoolean(reader);
                    mExportElectricCircuit = XmlReadWrite.readBoolean(reader);
                    mExportConnectionPoints = XmlReadWrite.readBoolean(reader);
                }
                reader.ReadEndElement();
            }

            // selected layer
            int selectedLayerIndex = reader.ReadElementContentAsInt();
            // step the progress bar after the read of the header
            MainForm.Instance.stepProgressBar();

            // layers
            // first clear the hashtable that contains all the bricks
            Map.sHashtableForRulerAttachementRebuilding.Clear();
            // then load all the layers
            bool layerFound = reader.ReadToDescendant("Layer");
            while (layerFound)
            {
                // get the 'type' attribute of the layer
                reader.ReadAttributeValue();
                string layerType = reader.GetAttribute(0);

                // instantiate the right layer according to the type
                Layer layer = null;
                if (layerType.Equals("grid"))
                    layer = new LayerGrid();
                else if (layerType.Equals("brick"))
                    layer = new LayerBrick();
                else if (layerType.Equals("text"))
                    layer = new LayerText();
                else if (layerType.Equals("area"))
                    layer = new LayerArea();
                else if (layerType.Equals("ruler"))
                    layer = new LayerRuler();

                // read and add the new layer
                if (layer != null)
                {
                    layer.ReadXml(reader);
                    mLayers.Add(layer);
                }

                // read the next layer
                layerFound = reader.ReadToNextSibling("Layer");
            }
            reader.ReadEndElement(); // end of Layers

            // once we have finished to read all the layers thus all the items, we need to recreate all the links they have between them
            foreach (Layer layer in mLayers)
                layer.recreateLinksAfterLoading();
            // then clear again the hash table to free the memory
            Map.sHashtableForRulerAttachementRebuilding.Clear();

            // step the progress bar after the rebuilding of links
            MainForm.Instance.stepProgressBar();

            // if the selected index is valid, reset the selected layer
            // use the setter in order to enable the toolbar buttons
            if ((selectedLayerIndex >= 0) && (selectedLayerIndex < mLayers.Count))
                SelectedLayer = mLayers[selectedLayerIndex];
            else
                SelectedLayer = null;

            // DO NOT READ YET THE BRICK URL LIST, BECAUSE THE BRICK DOWNLOAD FEATURE IS NOT READY
            if (false)
            {
                // read the url of all the parts for version 5 or later
                if ((mDataVersionOfTheFileLoaded > 5) && !reader.IsEmptyElement)
                {
                    bool urlFound = reader.ReadToDescendant("BrickUrl");
                    while (urlFound)
                    {
                        // read the next url
                        urlFound = reader.ReadToNextSibling("BrickUrl");
                    }
                    reader.ReadEndElement();
                }
            }

            // construct the watermark
            computeGeneralInfoWatermark();
            // for old version, make disapear the progress bar, since it was just an estimation
            MainForm.Instance.finishProgressBar();
        }
Пример #12
0
 public override void ReadXml(System.Xml.XmlReader reader)
 {
     base.ReadXml(reader);
     GridColor = XmlReadWrite.readColor(reader);
     GridThickness = reader.ReadElementContentAsFloat();
     SubGridColor = XmlReadWrite.readColor(reader);
     SubGridThickness = reader.ReadElementContentAsFloat();
     mGridSizeInStud = reader.ReadElementContentAsInt();
     mSubDivisionNumber = Math.Max(reader.ReadElementContentAsInt(), 2);
     if (reader.Name.Equals("DisplayGrid"))
         mDisplayGrid = reader.ReadElementContentAsBoolean();
     mDisplaySubGrid = reader.ReadElementContentAsBoolean();
     mDisplayCellIndex = reader.ReadElementContentAsBoolean();
     mCellIndexFont = XmlReadWrite.readFont(reader);
     CellIndexColor = XmlReadWrite.readColor(reader);
     mCellIndexColumnType = (CellIndexType)reader.ReadElementContentAsInt();
     mCellIndexRowType = (CellIndexType)reader.ReadElementContentAsInt();
     mCellIndexCorner = XmlReadWrite.readPoint(reader);
     // step the progress bar for the grid
     MainForm.Instance.stepProgressBar();
 }
Пример #13
0
            private void readTrackDesignerTag(ref System.Xml.XmlReader xmlReader)
            {
                // check if the track designer is not empty
                if (!xmlReader.IsEmptyElement)
                {
                    // the Track designer tag is not empty, instanciate the class that will hold the data
                    mTDRemapData = new TDRemapData();

                    // read the first child node
                    xmlReader.Read();
                    bool continueToRead = !xmlReader.EOF;
                    while (continueToRead)
                    {
                        if (xmlReader.Name.Equals("ID"))
                            readTrackDesignerIDTag(ref xmlReader);
                        else if (xmlReader.Name.Equals("IDList"))
                            readTrackDesignerIDListTag(ref xmlReader);
                        else if (xmlReader.Name.Equals("Flag"))
                            mTDRemapData.mFlags = xmlReader.ReadElementContentAsInt();
                        else if (xmlReader.Name.Equals("HasSeveralGeometries"))
                            mTDRemapData.mHasSeveralPort = xmlReader.ReadElementContentAsBoolean();
                        else if (xmlReader.Name.Equals("TDBitmapList"))
                            readTrackDesignerBitmapTag(ref xmlReader);
                        else
                            xmlReader.Read();

                        // check if we need to continue
                        continueToRead = !xmlReader.Name.Equals("TrackDesigner") && !xmlReader.EOF;
                    }

                    // finish the track designer tag
                    if (!xmlReader.EOF)
                        xmlReader.ReadEndElement();
                }
                else
                {
                    xmlReader.Read();
                }
            }
Пример #14
0
        /// <summary>
        /// Generates a Suggestion object from it's XML representation
        /// </summary>
        /// <param name="reader">XmlReader posistioned at the start node
        /// of the Suggestion XML</param>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            string xsTypes =
                "http://schemas.microsoft.com/exchange/services/2006/types";

            // Store the LocalName of the element we are currently at.
            // This should be "Suggestion".
            //
            // This also serves as our key to our position in the stream.
            // Once we reach an EndElement with this name, then we
            // are done with our portion of the XmlStream.
            //
            string toplevelElementName = reader.LocalName;
            reader.Read();

            while (true)
            {
                // Check to see if we are done processing
                if ((reader.NodeType == XmlNodeType.EndElement) &&
                    (0 == String.Compare(reader.LocalName, toplevelElementName)))
                {
                    // We are done, consume this EndElement and stop processing
                    reader.Read();
                    break;
                }

                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    // This likely means we are at the closing tag of
                    // </AttendeeConflictDataArray>
                    // No data here to process.
                    reader.Read();
                    continue;
                }

                // Consume MeetingTime
                if (0 == String.Compare(reader.LocalName, "MeetingTime"))
                {
                    // MeetingTime is the primary reason we needed to implement
                    // IXmlSerializable, the server will always append a UTC offset
                    // to the date/time string in the MeetingTime element.  This
                    // offset can not be trusted.  The 'time' of the suggestion is
                    // always valid if treated as Local time.
                    //
                    // We will use a Regular Expression to extract whatever was
                    // supplied as a local time only
                    //
                    string meetingTimeValue = reader.ReadElementContentAsString();
                    System.Text.RegularExpressions.Regex regex =
                        new System.Text.RegularExpressions.Regex(
                            @"(?<untimezoned>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})",
                            System.Text.RegularExpressions.RegexOptions.Compiled);

                    string nonUTCOffsettingString =
                        regex.Match(meetingTimeValue).Result("${untimezoned}");
                    this.meetingTimeField = DateTime.Parse(nonUTCOffsettingString);
                }

                // Consume IsWorkTime
                if (0 == String.Compare(reader.LocalName, "IsWorkTime"))
                {
                    this.isWorkTimeField = reader.ReadElementContentAsBoolean();
                }

                // Consume SuggestionQuality
                if (0 == String.Compare(reader.LocalName, "SuggestionQuality"))
                {
                    string value = reader.ReadElementContentAsString();
                    this.suggestionQualityField =
                        (SuggestionQuality)Enum.Parse(typeof
                            (SuggestionQuality), value);
                }

                // Consume AttendeeConflictDataArray
                if (0 == String.Compare(reader.LocalName,
                    "AttendeeConflictDataArray"))
                {
                    // Unfortunately, the XmlSerializer can't just de-serialize an
                    // array of items, therefore we need to look at the types of
                    // each indivudal elements of the array and de-serialize them
                    // based on their type.
                    XmlDocument xmld = new XmlDocument();
                    string outerXml = reader.ReadOuterXml();
                    xmld.LoadXml(outerXml);

                    if (!xmld.HasChildNodes)
                    {
                        // This an an empty AttendeeConflictDataArray, so were done.
                        this.attendeeConflictDataArrayField =
                            new AttendeeConflictData[0];
                        continue;
                    }

                    XmlNodeList attendeeConflictNodes = xmld.FirstChild.ChildNodes;
                    List<AttendeeConflictData> attendeeConflictDataList =
                        new List<AttendeeConflictData>(attendeeConflictNodes.Count);

                    foreach (XmlNode xmln in attendeeConflictNodes)
                    {
                        if (0 == String.Compare(xmln.Name,
                            "IndividualAttendeeConflictData"))
                        {
                            using (System.IO.StringReader strdr =
                                new System.IO.StringReader(xmln.OuterXml))
                            {
                                XmlSerializer xmls =
                                    new XmlSerializer(
                                        typeof(IndividualAttendeeConflictData),
                                        xsTypes);

                                attendeeConflictDataList.Add(
                                    (IndividualAttendeeConflictData)
                                    xmls.Deserialize(strdr));
                            }
                        }
                        if (0 == String.Compare(xmln.Name,
                            "GroupAttendeeConflictData"))
                        {
                            using (System.IO.StringReader strdr =
                                new System.IO.StringReader(xmln.OuterXml))
                            {
                                XmlSerializer xmls =
                                    new XmlSerializer(
                                        typeof(GroupAttendeeConflictData),
                                        xsTypes);

                                attendeeConflictDataList.Add(
                                    (GroupAttendeeConflictData)
                                    xmls.Deserialize(strdr));
                            }
                        }
                        if (0 == String.Compare(xmln.Name,
                            "UnknownAttendeeConflictData"))
                        {
                            using (System.IO.StringReader strdr =
                                new System.IO.StringReader(xmln.OuterXml))
                            {
                                XmlSerializer xmls =
                                    new XmlSerializer(
                                        typeof(UnknownAttendeeConflictData),
                                        xsTypes);

                                attendeeConflictDataList.Add(
                                    (UnknownAttendeeConflictData)
                                    xmls.Deserialize(strdr));
                            }
                        }
                        if (0 == String.Compare(xmln.Name,
                            "TooBigGroupAttendeeConflictData"))
                        {
                            using (System.IO.StringReader strdr =
                                new System.IO.StringReader(xmln.OuterXml))
                            {
                                XmlSerializer xmls =
                                    new XmlSerializer(
                                        typeof(TooBigGroupAttendeeConflictData),
                                        xsTypes);

                                attendeeConflictDataList.Add(
                                    (TooBigGroupAttendeeConflictData)
                                    xmls.Deserialize(strdr));
                            }
                        }
                    }

                    // Convert our list of AttendeeConflictData to an array
                    this.attendeeConflictDataArrayField =
                        attendeeConflictDataList.ToArray();
                }
            }
        }
Пример #15
0
        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();
        }
Пример #16
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "original_language", "Expected LocalName is 'original_language' rather than " + reader.LocalName);
            this.originalLanguage = new CodePhrase();
            this.OriginalLanguage.ReadXml(reader);

            if (reader.LocalName == "is_controlled")
            {
                this.IsControlled = reader.ReadElementContentAsBoolean("is_controlled", RmXmlSerializer.OpenEhrNamespace);

            }
            if (reader.LocalName == "description")
            {
                this.description = new ResourceDescription();
                this.description.ReadXml(reader);
            }

            string translationsNodeName = "translations";
            if (reader.LocalName == translationsNodeName)
            {
                System.Collections.Generic.Dictionary<string, TranslationDetails> translationDic = new Dictionary<string, TranslationDetails>();
                do
                {
                    TranslationDetails transDetails = new TranslationDetails();
                    transDetails.ReadXml(reader);

                    translationDic.Add(transDetails.Language.CodeString, transDetails);
                } while (reader.LocalName == translationsNodeName);

                if (translationDic.Count > 0)
                    this.translations = new OpenEhr.AssumedTypes.Hash<TranslationDetails, string>(translationDic);
            }

            if (reader.LocalName == "revision_history")
            {
                this.revisionHistory = new OpenEhr.RM.Common.Generic.RevisionHistory();
                this.revisionHistory.ReadXml(reader);
            }
        }
Пример #17
0
 private void readCanUngroupTag(ref System.Xml.XmlReader xmlReader)
 {
     if (!xmlReader.IsEmptyElement)
     {
         bool canUngroup = xmlReader.ReadElementContentAsBoolean();
         // we set the flag only if it's false. And also the brick must be a group,
         // so if we read the "CanUngroup" tag in a normal XML brick file, we just ignore this tag
         if (!canUngroup && ((this.mBrickType & BrickType.GROUP) != 0))
             this.mBrickType |= BrickType.SEALED_GROUP;
     }
     else
     {
         xmlReader.Read();
     }
 }