system.xml

System.XML on XAMARIN forms project

醉酒当歌 提交于 2020-04-30 04:21:46
问题 I am trying to use XmlDocument class ** and **XmlDocument .Load(..) function on the Portable Project of XAMARIN.Forms Portable solution with visual studio community. The compiler says that "The type or namespace name 'XmlDocument' could not be found (are you missing a using directive or an assembly reference?" If i go in References it don't allow me to add the System.XML namespace (there is no) and if i browse file and go to system.xml.dll it says me that the file could not be added because

Build a Custom Serialization as String in System.Xml.Serialization

Deadly 提交于 2020-01-17 02:21:11
问题 Hi guys I have 2 classes like this: [XmlRoot("Config")] public class ConfigClass { [XmlElement("Configuration1")] public string Config1 { get; set; } [XmlArray("Infos")] [XmlArrayItem("Info")] public OtherInfo[] OtherInfos { get; set; } } public class OtherInfo { public string Info1 { get; set; } public string Info2 { get; set; } } When I serialize the root class the XML result is like this: <?xml version="1.0"?> <Config> <Configuration1>Text</Configuration1> <Infos> <Info> <Info1>Test 2<

How to create a new System.Xml.Linq.XElement with PowerShell

守給你的承諾、 提交于 2019-12-24 13:26:16
问题 I want to create an XML DOM programmatically using the System.Xml.Linq objects. I'd rather not parse a string or load a file from disk to create the DOM. In C# this is easy enough, but trying to do this in PowerShell does not seem possible. Option 1 : Doesn't work $xlinq = [Reflection.Assembly]::Load("System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") $el = new-Object System.Xml.Linq.XElement "foo" This gives the following error: new-Object : Cannot convert

Custom module conditional configuration optons

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 22:41:34
问题 I would like to programmatically enable or disable specific options for a custom module on the administration panel depending on the status of a select. For example, if I had a Yes/No select something like do you want to handle stuffs? < select yes/no > and if stuffs == yes, then a number of other configuration fields would be enabled/visible. If stuffs != yes then those fields would be disabled/invisible. Is that possible to do programmatically via system.xml /some-other-means, or it is a

How to validate XML in .NET Core 1.1.2

与世无争的帅哥 提交于 2019-12-18 09:46:43
问题 How can i validate XML against XSD schema in .NET Core 1.1.2? i found this ms docs but i cannot use it with .NET core 1.1.2 using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.Xml.Schema; namespace MyNameSpace { public static class XmlValidation { public static void Validate(string schema, string xml) { XmlReaderSettings schemaSettings = new XmlReaderSettings(); schemaSettings.Schemas.Add(schema); schemaSettings.ValidationType = ValidationType

XElement.XPathEvaluate not evaluating exponential numbers correctly

只愿长相守 提交于 2019-12-11 04:35:10
问题 In my C# Program, I am loading a System.Xml.Linq.Xelement variable with a portion of an XML file I'm trying to parse and feeding it various XPaths to evaluate values for using the XPathEvaluate() method. My challenge is that my XML has some numbers stored as exponential numbers and the XPath is ignoring them even though I'm reading that XPath 2.0 should allow for these being understood to be numbers. A sample would look as follows: XML ( childNode ): <Parent> <Vals id="Val1"> <abc>1.8</abc> <

How to deserialize a list of objects where the children are directly in the root

杀马特。学长 韩版系。学妹 提交于 2019-12-10 15:26:13
问题 Consider the following XML: <?xml version="1.0" encoding="utf-8"?> <treelist id="foo" displayname="display"> <treelink id="link" /> </treelist> I've got the following code set up: private static void Main(string[] args) { StreamReader result = File.OpenText(@"test.xml"); var xmlTextReader = new XmlTextReader(result.BaseStream, XmlNodeType.Document, null); XDocument load = XDocument.Load(xmlTextReader); var xmlSerializer = new XmlSerializer(typeof (TreeList)); var foo = (TreeList)

XML bomb (Entity Injection) is by default taken care in .Net 4.0 but not in .Net 3.5. How? What changed?

我们两清 提交于 2019-12-10 13:38:44
问题 Following code XmlDocument xdoc = new XmlDocument(); String xml = @"<!DOCTYPE lolz [" + "<!ENTITY lol \"lol\">" + "<!ENTITY lol2 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\">" + "<!ENTITY lol3 \"&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;\">" + "<!ENTITY lol4 \"&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;\">" + "<!ENTITY lol5 \"&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;\">" + "<!ENTITY lol6 \"&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;

Can't use System.XML in Mono even though “About” dialog says it's loaded

别说谁变了你拦得住时间么 提交于 2019-12-02 20:59:28
问题 I'm getting desperate here; I'm trying to use XML serialization with some vanilla classes in Mono. [DataContract] and [DataMember] won't resolve, and using System.XML is impossible; it's just not in the list and won't compile suggesting a missing assembly reference. In the About-dialog I can clearly see that the System.XML library is loaded. How can I make it accessible to my project? MonoDevelop 3.0.5 Runtime: Mono 2.10.9 (tarball), GTK 2.24.10, GTK# (2.12.0.0), Package version: 210090011 I

How to validate XML in .NET Core 1.1.2

十年热恋 提交于 2019-11-29 17:31:42
How can i validate XML against XSD schema in .NET Core 1.1.2? i found this ms docs but i cannot use it with .NET core 1.1.2 using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.Xml.Schema; namespace MyNameSpace { public static class XmlValidation { public static void Validate(string schema, string xml) { XmlReaderSettings schemaSettings = new XmlReaderSettings(); schemaSettings.Schemas.Add(schema); schemaSettings.ValidationType = ValidationType.Schema; schemaSettings.ValidationEventHandler += new ValidationEventHandler(ValidationEventHandler);