ReadInnerXml() public method

public ReadInnerXml ( ) : string
return string
        internal static bool DecodeXmlTextReaderValue(object instance, PropertyInfo propertyInfo, XmlReader xmlTextReader)
        {
            try
            {
                // find related property by name if not provided as parameter
                if (propertyInfo == null)
                    propertyInfo = instance.GetType().GetProperty(xmlTextReader.Name, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);

                if (propertyInfo == null)
                    return false;
                // unescaped characters <>&
                if (propertyInfo.PropertyType.Equals(typeof(string)))
                    propertyInfo.SetValue(instance, Decode(xmlTextReader.ReadInnerXml().Trim()), null);
                else if (propertyInfo.PropertyType.Equals(typeof(DateTime)))
                    propertyInfo.SetValue(instance, ParseRfc822DateTime(xmlTextReader.ReadInnerXml().Trim()), null);
                else
                    propertyInfo.SetValue(instance, TypeDescriptor.GetConverter(propertyInfo.PropertyType).ConvertFromString(xmlTextReader.ReadInnerXml().Trim()), null);
            }
            catch (Exception e)
            {
                Debug.WriteLine(propertyInfo.Name + ", " + propertyInfo.PropertyType.Name + " / " + instance.ToString() + " " + e.Message);
                return false;
            }
            return true;
        }
 public override void PopulateFromXml(XmlReader reader)
 {
     if (reader.LocalName != "item" || reader.GetAttribute("type") != "category")
         return;  // If we weren't on the right kind of node, do nothing
     GuidStr = reader.GetAttribute("guid");
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
         case XmlNodeType.Element:
             {
                 switch (reader.LocalName)
                 {
                 case "item":
                     if (reader.GetAttribute("type") == "category")
                     {
                         var child = new CanonicalPartOfSpeechItem();
                         child.PopulateFromXml(reader);
                         AppendChild(child);
                     }
                     break;
                 case "abbrev":
                     AddAbbrev(reader.GetAttribute("ws"), reader.ReadInnerXml());
                     break;
                 case "term":
                     AddName(reader.GetAttribute("ws"), reader.ReadInnerXml());
                     break;
                 case "def":
                     AddDescription(reader.GetAttribute("ws"), reader.ReadInnerXml());
                     break;
                 case "citation":
                     Dictionary<string, List<string>> citationsDict = GetExtraDataWsDict<string>("citations");
                     string ws = reader.GetAttribute("ws");
                     List<string> citations = GetListFromDict<string>(citationsDict, ws);
                     citations.Add(reader.ReadInnerXml());
                     // No need to set anything in ExtraData, as GetListFromDict did it for us.
                     break;
                 }
                 break;
             }
         case XmlNodeType.EndElement:
             {
                 if (reader.LocalName == "item")
                 {
                     Key = AbbrevByWs(KeyWs);
                     reader.Read(); // Skip past the closing element before returning
                     return;
                 }
                 break;
             }
         }
     }
 }
Beispiel #3
0
 internal Effects(System.Xml.XmlReader reader)
 {
     Volume          = reader.GetIntegerAttribute("Volume");
     FadeInTime      = reader.GetIntegerAttributeOrDefault("FadeIn", 0);
     FadeOutTime     = reader.GetIntegerAttributeOrDefault("FadeOut", 0);
     CrossFading     = reader.GetBooleanAttributeOrDefault("CrossFading", false);
     HasRandomVolume = reader.GetBooleanAttributeOrDefault("HasRandomVolume", false);
     MinRandomVolume = reader.GetIntegerAttributeOrDefault("MinRandomVolume", 50);
     MaxRandomVolume = reader.GetIntegerAttributeOrDefault("MaxRandomVolume", 100);
     m_Pitch         = new IntEffect("Pitch", reader, 0);
     m_Balance       = new BalanceEffect(reader);
     m_Volume        = new IntEffect("Volume", reader, 0);
     m_Speakers      = new SpeakerAssignmentEffect(reader);
     m_Reverb        = new ReverbEffect(reader);
     m_Tempo         = new IntEffect("Tempo", reader, 0);
     #region tdmod
     m_CueIn  = new CueEffect("CueIn", reader);
     m_CueOut = new CueEffect("CueOut", reader);
     #endregion
     if (reader.IsEmptyElement)
     {
         reader.Read();
     }
     else
     {
         reader.Read();
         reader.ReadInnerXml();
         reader.ReadEndElement();
     }
 }
Beispiel #4
0
		public void ReadXml(XmlReader reader)
		{
			//goto inner hidden
			reader.Read();
		    Text = reader.ReadInnerXml();
			reader.Read();
		}
		public void ReadXml(XmlReader reader)
		{
			m_name = reader.Name;
			while (reader.Read())
			{
				reader.SkipEmptyNodes();

				if (reader.NodeType == XmlNodeType.EndElement)
				{
					// the end
					break;
				}
				else if (reader.NodeType == XmlNodeType.Element)
				{
					reader.Read();	// go into ValueNode
					reader.SkipEmptyNodes();
				}

				if (reader.NodeType != XmlNodeType.Text)
				{
					throw new Exception("Required NodeType: Text - Found: " + reader.NodeType);
				}

				var value = reader.ReadContentAsString();
				Pairs.Add(new KeyValuePair<string, string>(reader.Name, value));

				if (reader.NodeType == XmlNodeType.EndElement)
				{
					// the end
					reader.ReadInnerXml();
				}
			}
		}
        /// <summary>
        /// Creates an instance of the ReadWriteAttributeAssignment using the provided XmlReader.
        /// </summary>
        /// <param name="reader">The XmlReader positioned at the AttributeAssignament node.</param>
        /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
        public AttributeAssignmentElementReadWrite(XmlReader reader, XacmlVersion schemaVersion)
            : base(XacmlSchema.Policy, schemaVersion)
        {
            if (reader == null) throw new ArgumentNullException("reader");
            if (reader.LocalName == Consts.Schema1.ObligationElement.AttributeAssignment &&
                ValidateSchema(reader, schemaVersion))
            {
                if (reader.HasAttributes)
                {
                    // Load all the attributes
                    while (reader.MoveToNextAttribute())
                    {
                        if (reader.LocalName == Consts.Schema1.AttributeValueElement.DataType)
                        {
                            _dataType = reader.GetAttribute(Consts.Schema1.AttributeValueElement.DataType);
                        }
                        else if (reader.LocalName == Consts.Schema1.AttributeAssignmentElement.AttributeId)
                        {
                            _attributeId = reader.GetAttribute(Consts.Schema1.AttributeAssignmentElement.AttributeId);
                        }
                    }
                    reader.MoveToElement();
                }

                // Load the node contents
                _contents = reader.ReadInnerXml();
            }
            else
            {
                throw new Exception(string.Format(Properties.Resource.exc_invalid_node_name, reader.LocalName));
            }
        }
Beispiel #7
0
        public static object Deserialize(Type type, XmlReader reader, bool readInnerXml)
        {
            if (null == type) throw new ArgumentNullException("type");
            if (null == reader) throw new ArgumentNullException("reader");
            if (reader.NodeType != XmlNodeType.Element) throw new ArgumentException("reader is not positioned on an element");

            object value = null;
            StringBuilder serializationBuilder = new StringBuilder();
            serializationBuilder.Append("<?xml version=\"1.0\"?>");
            if (readInnerXml)
            {
                serializationBuilder.AppendLine(reader.ReadInnerXml());
            }
            else
            {
                serializationBuilder.AppendLine(reader.ReadOuterXml());
            }
            string serialization = serializationBuilder.ToString();
            using (StringReader stringReader = new StringReader(serialization))
            {
                XmlSerializer serializer = new XmlSerializer(type);
                value = serializer.Deserialize(stringReader);
            }
            return value;
        }
        /// <summary>
        /// Implements a custom deserialization of the key, using the type name as a type specifier.
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        protected override Type DeserializeKey(System.Xml.XmlReader reader)
        {
            var keyXml = reader.ReadInnerXml();
            var key    = Type.GetType(keyXml);

            return(key);
        }
Beispiel #9
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            bool wasEmpty = reader.IsEmptyElement;

            reader.Read();

            if (wasEmpty)
            {
                return;
            }

            while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
            {
                CustomProperty cp = new CustomProperty();
                cp.name        = reader.GetAttribute("Name");
                cp.description = reader.GetAttribute("Description");

                string type = reader.GetAttribute("Type");

                if (type == "string")
                {
                    cp.type = typeof(string);
                }
                if (type == "bool")
                {
                    cp.type = typeof(bool);
                }
                if (type == "Vector2")
                {
                    cp.type = typeof(Vector2);
                }
                if (type == "Color")
                {
                    cp.type = typeof(Color);
                }
                if (type == "Item")
                {
                    cp.type = typeof(Component);
                }

                if (cp.type == typeof(Component))
                {
                    cp.value = reader.ReadInnerXml();
                    this.Add(cp.name, cp);
                }
                else
                {
                    reader.ReadStartElement("Property");
                    XmlSerializer valueSerializer = new XmlSerializer(cp.type);
                    object        obj             = valueSerializer.Deserialize(reader);
                    cp.value = Convert.ChangeType(obj, cp.type);
                    this.Add(cp.name, cp);
                    reader.ReadEndElement();
                }

                reader.MoveToContent();
            }
            reader.ReadEndElement();
        }
Beispiel #10
0
 public override void ReadXml(XmlReader reader)
 {
     Name = reader.GetAttribute("name");
     Description = reader.ReadInnerXml().Trim();
     if (Description.Contains("this method interface declaration"))
     {
     }
 }
Beispiel #11
0
		public string FromXmlReader (XmlReader reader)
		{
			if (!reader.ReadToDescendant ("head"))
				return null;
			if (!reader.ReadToNextSibling ("body"))
				return null;

			return reader.ReadInnerXml ();
		}
Beispiel #12
0
    public static string InnerXml(this XElement node)
    {
        Debug.Assert(node != null);

        System.Xml.XmlReader reader = node.CreateReader();
        _ = reader.MoveToContent();

        return(reader.ReadInnerXml());
    }
Beispiel #13
0
            /// <summary>
            /// 读取Xml
            /// </summary>
            /// <param name="reader"></param>
            public void ReadXml(XmlReader reader)
            {
                String prefix = reader.Prefix;

                String xml = reader.ReadInnerXml();
                if (xml.StartsWith("<Fault") || xml.StartsWith("<" + prefix + ":Fault"))
                    Fault = xml;
                else
                    Xml = xml;
            }
        private static SecurityKeyIdentifierClause ReadRSAKeyValue(XmlReader reader)
        {
            string rsaXmlElement = reader.ReadInnerXml();

            var rsa = new RSACryptoServiceProvider(); // Do not dispose! Used later when creating key
            rsa.FromXmlString(rsaXmlElement);
            RsaKeyIdentifierClause clause = new RsaKeyIdentifierClause(rsa);

            return clause;
        }
Beispiel #15
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            XmlSerializer stringSerializer = new XmlSerializer(typeof(string));
            XmlSerializer intSerializer    = new XmlSerializer(typeof(int));


            bool wasEmpty = reader.IsEmptyElement;

            reader.Read();

            if (wasEmpty)
            {
                return;
            }

            reader.MoveToContent();
            while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
            {
                string element = reader.Name.ToLower();

                reader.ReadStartElement();

                switch (element)
                {
                case "name":
                    Name = (string)stringSerializer.Deserialize(reader);
                    break;

                case "league":
                    League = (Leagues)intSerializer.Deserialize(reader);
                    break;

                case "race":
                    Race = (Matchup.Races)intSerializer.Deserialize(reader);
                    break;

                case "points":
                    Points = (int)intSerializer.Deserialize(reader);
                    break;

                case "place":
                    Place = (int)intSerializer.Deserialize(reader);
                    break;

                default:
                    reader.ReadInnerXml();
                    break;
                }
                reader.ReadEndElement();
                reader.MoveToContent();
            }

            reader.ReadEndElement();
        }
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (!reader.IsEmptyElement)
            {
                string ruleSetXml = reader.ReadInnerXml();

                XmlReader innerReader = XmlReader.Create(new StringReader(ruleSetXml));
                WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();
                RuleSet = serializer.Deserialize(innerReader) as RuleSet;
            }
        }
Beispiel #17
0
        void System.Xml.Serialization.IXmlSerializable.ReadXml(Xml.XmlReader reader)
        {
            var content = reader.ReadInnerXml();

            string mediatype;

            byte[] bytes;
            ParseInternal(content, out mediatype, out bytes);

            this._MediaType = mediatype;
            this._Bytes     = bytes;
        }
 void IXmlSerializable.ReadXml(XmlReader reader)
 {
     string s = reader.ReadInnerXml();
     string startTag = "<![CDATA[";
     string endTag = "]]>";
     char[] trims = new char[] { '\r', '\n', '\t', ' ' };
     s = s.Trim(trims);
     if (s.StartsWith(startTag) && s.EndsWith(endTag))
     {
         s = s.Substring(startTag.Length, s.LastIndexOf(endTag) - startTag.Length);
     }
     this._innerSourceXml = s;
     this._innerXml = s.Trim(trims);
 }
Beispiel #19
0
        private string ReadXmlFile()
        {
            using (Xml.XmlReader reader = Xml.XmlReader.Create("TestXml.xml"))
            {
                var text = reader.ReadInnerXml();

                while (reader.Read())
                {
                    int a = 100;
                }
            }

            return(String.Empty);
        }
 /// <summary>
 /// Creates an instance of the AttributeValue using the XmlReader provided.
 /// </summary>
 /// <param name="reader">The XmlReader positioned at the AttributeValue node.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public AttributeValueElementReadWrite(XmlReader reader, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     if (reader == null) throw new ArgumentNullException("reader");
     if (reader.LocalName == Consts.ContextSchema.AttributeElement.AttributeValue &&
         ValidateSchema(reader, schemaVersion))
     {
         // Load the node contents
         _contents = reader.ReadInnerXml();
     }
     else
     {
         throw new Exception(string.Format(Properties.Resource.exc_invalid_node_name, reader.LocalName));
     }
 }
Beispiel #21
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.IsEmptyElement)
            {
                reader.ReadStartElement();
                return;
            }

            string someDate = reader.ReadInnerXml();

            if (StringExtensions.IsNullOrWhiteSpace(someDate) == false)
            {
                Value = XmlConvert.ToDateTime(someDate, XML_DATE_FORMAT);
            }
        }
Beispiel #22
0
        public new void ReadXml(System.Xml.XmlReader reader)
        {
            while (reader.Read())
            {
                base.ReadXml(reader);

                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "GenericData":
                        string innerXML = reader.ReadInnerXml();
                        GenericData = innerXML;
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlSerializationContextInfo" /> class.
        /// </summary>
        /// <param name="xmlReader">The XML reader.</param>
        /// <param name="model">The model.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlReader" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="model" /> is <c>null</c>.</exception>
        public XmlSerializationContextInfo(XmlReader xmlReader, ModelBase model)
        {
            Argument.IsNotNull("xmlReader", xmlReader);
            Argument.IsNotNull("model", model);

            var modelType = model.GetType();
            var elementStart = string.Format("<{0}", modelType.Name);

            if (xmlReader.HasAttributes)
            {
                for (int i = 0; i < xmlReader.AttributeCount; i++)
                {
                    xmlReader.MoveToAttribute(i);

                    var attributeName = xmlReader.LocalName;
                    var attributeValue = xmlReader.Value;

                    elementStart += string.Format(" {0}=\"{1}\"", attributeName, attributeValue);
                }

                xmlReader.MoveToElement();
            }

            elementStart += ">";

            xmlReader.MoveToContent();

            var xmlContent = xmlReader.ReadInnerXml();
            if (xmlContent.StartsWith("&lt;"))
            {
#if SL5
                xmlContent = System.Windows.Browser.HttpUtility.HtmlDecode(xmlContent);
#else
                xmlContent = System.Net.WebUtility.HtmlDecode(xmlContent);
#endif
            }

            var elementEnd = string.Format("</{0}>", modelType.Name);

            var finalXmlContent = string.Format("{0}{1}{2}", elementStart, xmlContent, elementEnd);
            Initialize(finalXmlContent, model);
        }
Beispiel #24
0
        /// <summary>
        /// Generates a <see cref="SerializableError"/> object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="XmlReader"/> stream from which the object is deserialized.</param>
        public void ReadXml(XmlReader reader)
        {
            if (reader.IsEmptyElement)
            {
                reader.Read();
                return;
            }

            reader.ReadStartElement();
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                var key = XmlConvert.DecodeName(reader.LocalName);
                var value = reader.ReadInnerXml();

                SerializableError.Add(key, value);
                reader.MoveToContent();
            }

            reader.ReadEndElement();
        }
        /// <summary>Initializes a new instance of RssCloud</summary>
        public RssCloud(XmlReader xmlTextReader)
        {
            if (!xmlTextReader.HasAttributes)
                return;

            PropertyInfo propertyInfo = null;

            while (xmlTextReader.MoveToNextAttribute())
            {
                // find related property by name
                propertyInfo = GetType().GetProperty(xmlTextReader.Name, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
                if (propertyInfo != null)
                {
                    // Protocol enum needs some conversion before the typeconverter can set the values that contains - char
                    if (propertyInfo.Name == "Protocol")
                        propertyInfo.SetValue(this, TypeDescriptor.GetConverter(propertyInfo.PropertyType).ConvertFromString(xmlTextReader.ReadInnerXml().Trim().Replace("-", "")), null);
                    else
                        XmlSerializationUtil.DecodeXmlTextReaderValue(this, xmlTextReader);
                }
            }
        }
Beispiel #26
0
			public void ReadXml(XmlReader reader)
			{
				try
				{
					string inner = reader.ReadInnerXml();

					string text = string.Empty;

					var matches = reg.Matches( inner );

					if( matches.Count > 0 )
					{
						text = string.Join( "\n", matches.Cast<Match>().Select( x => x.Groups[1].Value ) );
					}

					Text = HttpUtility.HtmlDecode( text );
				}
				catch (Exception)
				{
					
				}
			}
 public IEnumerable<IDataObject> BindRdfDataObjects(XmlReader xmlReader)
 {
     SkipToStartElement(xmlReader);
     while(!xmlReader.EOF)
     {
         if (xmlReader.NodeType != XmlNodeType.Element) SkipToStartElement(xmlReader);
         if (!xmlReader.EOF)
         {
             var resource = xmlReader.GetAttribute("about", RdfNamespace);
             if (resource != null)
             {
                 var dataobject = BindRdfDataObject(resource, xmlReader.NamespaceURI + xmlReader.LocalName,
                                                    xmlReader);
                 if (dataobject != null) yield return dataobject;
             }
             else
             {
                 xmlReader.ReadInnerXml();
             }
         }
     }            
 } 
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlSerializationContextInfo" /> class.
        /// </summary>
        /// <param name="xmlReader">The XML reader.</param>
        /// <param name="model">The model.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="xmlReader" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="model" /> is <c>null</c>.</exception>
        public XmlSerializationContextInfo(XmlReader xmlReader, ModelBase model)
        {
            Argument.IsNotNull("xmlReader", xmlReader);
            Argument.IsNotNull("model", model);

            xmlReader.MoveToContent();

            var xmlContent = xmlReader.ReadInnerXml();
            if (xmlContent.StartsWith("&lt;"))
            {
#if SL5
                xmlContent = System.Windows.Browser.HttpUtility.HtmlDecode(xmlContent);
#else
                xmlContent = System.Net.WebUtility.HtmlDecode(xmlContent);
#endif
            }

            var modelType = model.GetType();
            var elementStart = string.Format("<{0}>", modelType.Name);
            var elementEnd = string.Format("</{0}>", modelType.Name);

            var finalXmlContent = string.Format("{0}{1}{2}", elementStart, xmlContent, elementEnd);
            Initialize(finalXmlContent, model);
        }
 public void Read(XmlReader reader, object instance)
 {
     ((Custom) instance).InnerXml = reader.ReadInnerXml();
 }
            public void ReadXml(XmlReader reader)
            {
                if (reader.IsEmptyElement)
                    return;

                ReadXml(reader.ReadInnerXml());
            }
Beispiel #31
0
		public void ReadInnerXml (XmlReader reader)
		{
			reader.Read ();
			reader.Read ();
			Assert.AreEqual (ReadState.Interactive, reader.ReadState, "initial.ReadState");
			Assert.AreEqual (false, reader.EOF, "initial.EOF");
			Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "initial.NodeType");
			string s = reader.ReadInnerXml ();
			Assert.AreEqual ("test of <b>mixed</b> string.", s, "read_all");
			Assert.AreEqual ("bar", reader.Name, "after.Name");
			Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "after.NodeType");
		}
Beispiel #32
0
		private void ReadInnerXmlOnEndElement (XmlReader xmlReader)
		{
			xmlReader.Read ();
			xmlReader.Read ();
			xmlReader.Read ();
			Assert.AreEqual (String.Empty, xmlReader.ReadInnerXml ());
		}
 /// <summary>Initializes a new instance of RssCloud</summary>
 public RssCloud(System.Xml.XmlReader xmlTextReader)
 {
     if (!xmlTextReader.HasAttributes)
     {
         return;
     }
     //
     System.Reflection.PropertyInfo propertyInfo = null;
     //
     while (xmlTextReader.MoveToNextAttribute())
     {
         // find related property by name
         propertyInfo = GetType().GetProperty(xmlTextReader.Name, System.Reflection.BindingFlags.IgnoreCase | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
         if (propertyInfo != null)
         {
             // Protocol enum needs some conversion before the typeconverter can set the values that contains - char
             if (propertyInfo.Name == "Protocol")
             {
                 propertyInfo.SetValue(this, System.ComponentModel.TypeDescriptor.GetConverter(propertyInfo.PropertyType).ConvertFromString(xmlTextReader.ReadInnerXml().Trim().Replace("-", "")), null);
             }
             else
             {
                 XmlSerializationUtil.DecodeXmlTextReaderValue(this, xmlTextReader);
             }
         }
     }
 }
 public override string ReadInnerXml()
 {
     return(reader.ReadInnerXml());
 }
Beispiel #35
0
 /// <summary>Initializes a new instance of OpmlOutline</summary>
 public OpmlOutline(System.Xml.XmlReader xmlTextReader) : this()
 {
     if (!xmlTextReader.HasAttributes)
     {
         return;
     }
     // get attributes
     System.Reflection.PropertyInfo propertyInfo = null;
     for (int i = 0; i < xmlTextReader.AttributeCount; i++)
     {
         xmlTextReader.MoveToAttribute(i);
         // try to find some common used alias names for attributes
         string attributeName = xmlTextReader.Name;
         if (attributeName.IndexOf("url") != -1)
         {
             attributeName = "xmlUrl";
         }
         if (attributeName.IndexOf("title") != -1)
         {
             attributeName = "text";
         }
         // find related property by name
         propertyInfo = GetType().GetProperty(attributeName, System.Reflection.BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
         if (propertyInfo != null)
         {
             propertyInfo.SetValue(this, System.ComponentModel.TypeDescriptor.GetConverter(propertyInfo.PropertyType).ConvertFromString(xmlTextReader.ReadInnerXml().Trim()), null);
         }
     }
 }
Beispiel #36
0
        private VkDocType GetVkDocType(XmlReader xml)
        {
            var type = new VkDocType {FullName = GetMemberName(xml, "T:")};

            while (xml.Read())
            {
                if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "member")
                    break;

                if (xml.NodeType == XmlNodeType.Element && xml.Name == "summary")
                {
                    //type.Summary = xml.ReadElementContentAsString().Trim();
                    type.Summary = xml.ReadInnerXml().Trim();
                }
            }

            return type;
        }
        protected override bool OnDeserializeUnrecognizedElement(string elementName, System.Xml.XmlReader reader)
        {
            if (OptionElements == null)
            {
                OptionElements = new NameValueCollection();
            }

            //Because ConfigurationElement.DeserializeElemenet() method only accept outerXml and in MS.NET, it accept innerXml,
            //so there is a hack over here
            OptionElements.Add(elementName, Platform.IsMono ? reader.ReadOuterXml() : reader.ReadInnerXml());

            return(true);
        }
Beispiel #38
0
 public override string ReadInnerXml()
 {
     CheckAsync();
     return(coreReader.ReadInnerXml());
 }
Beispiel #39
0
        private Win32API.KeyEvent JudgeKeyevent(XmlReader reader, Win32API.KeyEvent keyEvent)
        {
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "KeyEvent")
                {
                    string eventName = reader.ReadInnerXml();
                    if (eventName == KeyboardEvents.WM_KeyUp.ToString())
                    {
                        keyEvent.dwFlags = Win32API.KBEventFlag.KeyUp;
                    }
                    else if (eventName == KeyboardEvents.WM_KeyDown.ToString())
                    {
                        keyEvent.dwFlags = Win32API.KBEventFlag.KeyDown;
                    }
                    break;
                }

            }
            return keyEvent;
        }
Beispiel #40
0
        public void ConsumeNodeXml(XmlReader xml, string domainNodeId, string documentLibraryUrl)
        {
            if (xml != null && xml.NodeType == XmlNodeType.Element && xml.Name == "node")
            {
                #region Attribute Values
                #region Id
                if (xml.MoveToAttribute("id"))
                {
                    Id = xml.Value;
                }
                #endregion

                #region NodeType
                if (Id == domainNodeId)
                {
                    _nodeType = IoCContainer.GetInjectionInstance().GetInstance<DomainNode>();
                }
                else 
                {
                    if (xml.MoveToAttribute("type"))
                    {
                        switch (xml.Value)
                        {
                            case CON_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<ConNode>();
                                break;

                            case DECISION_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<DecisionNode>();
                                break;

                            case IDEA_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<IdeaNode>();
                                break;

                            case MAP_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<MapNode>();
                                break;

                            case PRO_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<ProNode>();
                                break;

                            case QUESTION_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<QuestionNode>();
                                break;

                            case REFERENCE_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<ReferenceNode>();
                                break;

                            case ARGUMENT_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<ArgumentNode>();
                                break;

                            case NOTE_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<NoteNode>();
                                break;

                            case LIST_NODE_TYPE_ID:
                                _nodeType = IoCContainer.GetInjectionInstance().GetInstance<ListNode>();
                                break;

                            default:
                                break;
                        }
                    }
                }
                #endregion

                #region CreatedBy
                if (xml.MoveToAttribute("author"))
                {
                    CreatedBy = xml.Value;
                }
                #endregion

                #region Created
                if (xml.MoveToAttribute("created"))
                {
                    string createdMillisecondsXmlValue = xml.Value;
                    long createdMilliseconds;

                    if (long.TryParse(createdMillisecondsXmlValue, out createdMilliseconds))
                    {
                        Created = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                        Created = Created.AddMilliseconds(createdMilliseconds);
                    }
                }
                #endregion

                #region LastModified
                if (xml.MoveToAttribute("lastModified"))
                {
                    string lastModifiedMillisecondsXmlValue = xml.Value;
                    long lastModifiedMilliseconds;

                    if (long.TryParse(lastModifiedMillisecondsXmlValue, out lastModifiedMilliseconds))
                    {
                        LastModified = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                        LastModified = LastModified.AddMilliseconds(lastModifiedMilliseconds);
                    }
                }
                #endregion

                #region Name
                if (xml.MoveToAttribute("label"))
                {
                    Name = xml.Value;
                }
                #endregion

                #region LastModifiedBy
                if (xml.MoveToAttribute("lastModificationAuthor"))
                {
                    LastModifiedBy = xml.Value;
                }
                #endregion
                #endregion

                while (xml.Read())
                {
                    if (xml.NodeType == XmlNodeType.Element)
                    {
                        if (_nodeType.Name == "CompendiumReferenceNode")
                        {
                            if (xml.Name.ToLower() == "source")
                            {
                                string fullFilePath = xml.ReadInnerXml();
                                if (!string.IsNullOrEmpty(fullFilePath))
                                {
                                    if (fullFilePath.ToLower().StartsWith("http://") || fullFilePath.ToLower().StartsWith("https://")
                                        || fullFilePath.ToLower().StartsWith("ftp://") || fullFilePath.ToLower().StartsWith("ftps://"))
                                    {
                                        Attachment = fullFilePath;
                                    }
                                    else
                                    {
                                        string linkedFileName = string.Empty;
                                        if (fullFilePath.LastIndexOf("/") < 0 && fullFilePath.LastIndexOf("\\") > 0)
                                        {
                                            linkedFileName = fullFilePath.Substring(fullFilePath.LastIndexOf("\\") + 1);
                                        }
                                        else
                                        {
                                            linkedFileName = fullFilePath.Substring(fullFilePath.LastIndexOf("/") + 1);
                                        }
                                        Attachment = documentLibraryUrl + linkedFileName; //set the file name, the node name is can change independently
                                    }
                                }
                            }
                        }
                    }
                    else if (xml.NodeType == XmlNodeType.EndElement && xml.Name == "node")
                    {
                        break;
                    }
                }
            }
        }
            private void ParseCallback(XmlReader reader)
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    string localName = reader.LocalName;
                    if (XmlNames.ElementEquals(localName, XmlNames.ExampleElementName) && _comment.ExampleText == null)
                    {
                        _comment.ExampleText = reader.ReadInnerXml().Trim(); // TODO: trim each line
                    }
                    else if (XmlNames.ElementEquals(localName, XmlNames.SummaryElementName) && _comment.SummaryText == null)
                    {
                        _comment.SummaryText = reader.ReadInnerXml().Trim(); // TODO: trim each line
                    }
                    else if (XmlNames.ElementEquals(localName, XmlNames.ReturnsElementName) && _comment.ReturnsText == null)
                    {
                        _comment.ReturnsText = reader.ReadInnerXml().Trim(); // TODO: trim each line
                    }
                    else if (XmlNames.ElementEquals(localName, XmlNames.RemarksElementName) && _comment.RemarksText == null)
                    {
                        _comment.RemarksText = reader.ReadInnerXml().Trim(); // TODO: trim each line
                    }
                    else if (XmlNames.ElementEquals(localName, XmlNames.ParameterElementName))
                    {
                        string name = reader.GetAttribute(XmlNames.NameAttributeName);
                        string paramText = reader.ReadInnerXml();

                        if (!string.IsNullOrWhiteSpace(name) && !_comment._parameterTexts.ContainsKey(name))
                        {
                            (_parameterNamesBuilder ?? (_parameterNamesBuilder = ImmutableArray.CreateBuilder<string>())).Add(name);
                            _comment._parameterTexts.Add(name, paramText.Trim()); // TODO: trim each line
                        }
                    }
                    else if (XmlNames.ElementEquals(localName, XmlNames.TypeParameterElementName))
                    {
                        string name = reader.GetAttribute(XmlNames.NameAttributeName);
                        string typeParamText = reader.ReadInnerXml();

                        if (!string.IsNullOrWhiteSpace(name) && !_comment._typeParameterTexts.ContainsKey(name))
                        {
                            (_typeParameterNamesBuilder ?? (_typeParameterNamesBuilder = ImmutableArray.CreateBuilder<string>())).Add(name);
                            _comment._typeParameterTexts.Add(name, typeParamText.Trim()); // TODO: trim each line
                        }
                    }
                    else if (XmlNames.ElementEquals(localName, XmlNames.ExceptionElementName))
                    {
                        string type = reader.GetAttribute(XmlNames.CrefAttributeName);
                        string exceptionText = reader.ReadInnerXml();

                        if (!string.IsNullOrWhiteSpace(type))
                        {
                            if (_exceptionTextBuilders == null || !_exceptionTextBuilders.ContainsKey(type))
                            {
                                (_exceptionTypesBuilder ?? (_exceptionTypesBuilder = ImmutableArray.CreateBuilder<string>())).Add(type);
                                (_exceptionTextBuilders ?? (_exceptionTextBuilders = new Dictionary<string, ImmutableArray<string>.Builder>())).Add(type, ImmutableArray.CreateBuilder<string>());
                            }

                            _exceptionTextBuilders[type].Add(exceptionText);
                        }
                    }
                    else if (XmlNames.ElementEquals(localName, XmlNames.CompletionListElementName))
                    {
                        string cref = reader.GetAttribute(XmlNames.CrefAttributeName);
                        if (!string.IsNullOrWhiteSpace(cref))
                        {
                            _comment.CompletionListCref = cref;
                        }

                        reader.ReadInnerXml();
                    }
                    else
                    {
                        // This is an element we don't handle. Skip it.
                        reader.Read();
                    }
                }
                else
                {
                    // We came across something that isn't a start element, like a block of text.
                    // Skip it.
                    reader.Read();
                }
            }
        void ReadXml(XmlReader reader)
        {
            CommonUtility.AssertNotNull("reader", reader);

            this.AdditionalDetails = new Dictionary<string, string>();

            reader.ReadStartElement();
            while (reader.IsStartElement())
            {
                if (reader.IsEmptyElement)
                {
                    reader.Skip();
                }
                else
                {
                    if ((string.Compare(reader.LocalName, Constants.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(reader.LocalName, Constants.ErrorCodePreview, StringComparison.Ordinal) == 0))
                    {
                        this.ErrorCode = reader.ReadElementContentAsString();
                    }
                    else if ((string.Compare(reader.LocalName, Constants.ErrorMessage, StringComparison.OrdinalIgnoreCase) == 0) || (string.Compare(reader.LocalName, Constants.ErrorMessagePreview, StringComparison.Ordinal) == 0))
                    {
                        this.ErrorMessage = reader.ReadElementContentAsString();
                    }
                    else if (string.Compare(reader.LocalName, Constants.ErrorException, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        reader.ReadStartElement();
                        while (reader.IsStartElement())
                        {
                            switch (reader.LocalName)
                            {
                                case Constants.ErrorExceptionMessage:
                                    this.AdditionalDetails.Add(
                                    Constants.ErrorExceptionMessage,
                                    reader.ReadElementContentAsString(Constants.ErrorExceptionMessage, string.Empty));
                                    break;

                                case Constants.ErrorExceptionStackTrace:
                                    this.AdditionalDetails.Add(
                                    Constants.ErrorExceptionStackTrace,
                                    reader.ReadElementContentAsString(Constants.ErrorExceptionStackTrace, string.Empty));
                                    break;

                                default:
                                    reader.Skip();
                                    break;
                            }
                        }

                        reader.ReadEndElement();
                    }
                    else
                    {
                        this.AdditionalDetails.Add(
                        reader.LocalName,
                        reader.ReadInnerXml());
                    }
                }
            }

            reader.ReadEndElement();
        }
Beispiel #43
0
 void IXmlSerializable.ReadXml(XmlReader reader)
 {
     string text = reader.ReadInnerXml();
     this.RawValue = DeserializeStringSafe(text).RawValue;
 }
		void DoDeserializeSection (XmlReader reader)
		{
			reader.MoveToContent ();

			string protection_provider = null;
			string config_source = null;
			string localName;
			
			while (reader.MoveToNextAttribute ()) {
				localName = reader.LocalName;
				if (localName == "configProtectionProvider")
					protection_provider = reader.Value;
				else if (localName == "configSource")
					config_source = reader.Value;
			}

			/* XXX this stuff shouldn't be here */
			{
				if (protection_provider != null) {
					ProtectedConfigurationProvider prov = ProtectedConfiguration.GetProvider (protection_provider, true);
					XmlDocument doc = new ConfigurationXmlDocument ();

					reader.MoveToElement ();

					doc.Load (new StringReader (reader.ReadInnerXml ()));

					XmlNode n = prov.Decrypt (doc);

					reader = new XmlNodeReader (n);

					SectionInformation.ProtectSection (protection_provider);

					reader.MoveToContent ();
				}
			}

			if (config_source != null)
				SectionInformation.ConfigSource = config_source;
			
			SectionInformation.SetRawXml (RawXml);
			if (SectionHandler == null)
				DeserializeElement (reader, false);
		}
        /// <summary>
        /// This method retrieves an XmlReader within a specified context.
        /// Moreover it collects label values before or after a geometry could be found.
        /// </summary>
        /// <param name="reader">An XmlReader instance that is the origin of a created sub-reader</param>
        /// <param name="labelValue">A string array for recording a found label value. Pass 'null' to ignore searching for label values</param>
        /// <param name="pathNodes">A list of <see cref="IPathNode"/> instances defining the context of the retrieved reader</param>
        /// <returns>A sub-reader of the XmlReader given as argument</returns>
        protected XmlReader GetSubReaderOf(XmlReader reader, string[] labelValue, List<IPathNode> pathNodes)
        {
            string errorMessage = null;

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (pathNodes[0].Matches(reader))
                    {
                        pathNodes.RemoveAt(0);

                        if (pathNodes.Count > 0)
                            return GetSubReaderOf(reader.ReadSubtree(), null, pathNodes);

                        return reader.ReadSubtree();
                    }

                    if (labelValue != null)
                        if (_LabelNode != null)
                            if (_LabelNode.Matches(reader))
                                labelValue[0] = reader.ReadElementString();

                    if (_ServiceExceptionNode.Matches(reader))
                    {
                        errorMessage = reader.ReadInnerXml();
                        Trace.TraceError("A service exception occured: " + errorMessage);
                        throw new Exception("A service exception occured: " + errorMessage);
                    }
                }
            }

            return null;
        }
Beispiel #46
0
        private static ITestCommand ReadTestCommand(System.Xml.XmlReader reader, string comment, string sessionId)
        {
            var cmd = ReadCommand(reader, comment, sessionId);

            if (cmd != null)
            {
                return(cmd);
            }

            switch (reader.LocalName)
            {
            case "AssertMatch":
                var result = new AssertMatch()
                {
                    Comment = comment,
                    Match   = reader.GetAttribute("match")
                };
                var removeSys = reader.GetAttribute("removeSysProps");
                result.RemoveSystemProperties = (removeSys != "0");

                using (var subReader = reader.ReadSubtree())
                {
                    subReader.Read();
                    while (!subReader.EOF)
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            switch (reader.LocalName)
                            {
                            case "Remove":
                                result.Removes.Add(reader.GetAttribute("match"));
                                subReader.Read();
                                break;

                            case "Expected":
                                bool isXml;
                                result.Expected = ProcessXmlValue(reader.ReadInnerXml(), out isXml);
                                result.IsXml    = isXml;
                                break;

                            default:
                                subReader.Read();
                                break;
                            }
                        }
                        else
                        {
                            subReader.Read();
                        }
                    }
                }
                reader.Read();
                return(result);

            case "DownloadFile":
                return(new DownloadFile()
                {
                    Comment = comment,
                    Text = reader.ReadInnerXml()
                });
            }
            return(null);
        }