Exemplo n.º 1
0
        public ThingBase Deserialize(string thingXml)
        {
            using (XmlReader thingReader = SDKHelper.GetXmlReaderForXml(thingXml, SDKHelper.XmlReaderSettings))
            {
                thingReader.NameTable.Add("wc");
                thingReader.MoveToContent();

                return(DeserializeItem(thingReader));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Populates the description of the code from the XML.
        /// </summary>
        ///
        /// <param name="navigator">
        /// The XML node representing the coded item.
        /// </param>
        ///
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="navigator"/> parameter is <b>null</b>.
        /// </exception>
        ///
        public override void ParseXml(XPathNavigator navigator)
        {
            Validator.ThrowIfNavigatorNull(navigator);

            Value = navigator.SelectSingleNode("code-value").Value;

            DisplayText = XPathHelper.GetOptNavValue(navigator, "display-text");

            // preserve previous behavior where items without abbreviations have an empty string...
            string abbreviationText = XPathHelper.GetOptNavValue(navigator, "abbreviation-text");

            if (abbreviationText != null)
            {
                AbbreviationText = abbreviationText;
            }

            XPathNavigator infoNav
                = navigator.SelectSingleNode("info-xml");

            if (infoNav != null)
            {
                try
                {
                    using (XmlReader reader = SDKHelper.GetXmlReaderForXml(infoNav.InnerXml, SDKHelper.XmlReaderSettings))
                    {
                        _infoXml = new XPathDocument(reader);
                    }
                }
                catch (XmlException)
                {
                    // don't want to expose info about XML parse errors here
                    // to the outside world as recommended in .NET
                    // documentation
                    throw new HealthServiceException(
                              HealthServiceStatusCode.VocabularyLoadError);
                }
            }
        }