xmldocument

IE9 selectSingleNode missing from beta, how to overcome this in JavaScript?

送分小仙女□ 提交于 2019-11-29 12:36:46
XMLDocument object in Internet Explorer 9 does not contain definition for selectSingleNode Xpath-based traversal anymore. Of course, I googled a little and came across this thread, where it is unsure is it missing by specification or by the fact it is still "in beta". http://social.msdn.microsoft.com/Forums/en/iewebdevelopment/thread/0dc55c4d-4a63-4a12-b5cc-e4e12cc13d91 Anyone have idea how to resolve this, is there some other way of XPath traversal trough XMLDocument that is "IE9 Way"? XPath is not available in IE9's native XML support; we recommend moving to the Selectors API instead. If

From XmlDocument To XmlReader .Net

半城伤御伤魂 提交于 2019-11-29 11:18:49
问题 After an advice from a user that answered to my question I'm tring to convert my XmlDocument code to XmlReader code but I'm having some troubles. This is XML (generated from php-mysql Page) <row> <idLink>64</idLink> <idHost>3</idHost> <url>http://www.google.com</url> </row> <row> <idLink>68</idLink> <idHost>4</idHost> <url>http://www.bing.com</url> </row> ..... until about 10000 rows This is my XmlDocument code: xmlDoc.Load("http://www.myUrl.com/list.php"); if (xmlDoc.DocumentElement != null)

How to programmatically modify assemblyBinding in app.config?

陌路散爱 提交于 2019-11-29 09:45:28
I am trying to change the bindingRedirect element at install time by using the XmlDocument class and modifying the value directly. Here is what my app.config looks like: <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> ... </sectionGroup> </configSections> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="MyDll" publicKeyToken="31bfe856bd364e35"/> <bindingRedirect oldVersion="0.7"

using xmldocument to read xml

雨燕双飞 提交于 2019-11-29 07:53:41
<?xml version="1.0" encoding="utf-8" ?> <testcase> <date>4/12/13</date> <name>Mrinal</name> <subject>xmlTest</subject> </testcase> I am trying to read the above xml using c#, But i get null exception in the try catch block can any body suggest the required change. static void Main(string[] args) { XmlDocument xd = new XmlDocument(); xd.Load("C:/Users/mkumar/Documents/testcase.xml"); XmlNodeList nodelist = xd.SelectNodes("/testcase"); // get all <testcase> nodes foreach (XmlNode node in nodelist) // for each <testcase> node { CommonLib.TestCase tc = new CommonLib.TestCase(); try { tc.name =

C# : Modify a xml node

孤街醉人 提交于 2019-11-29 06:05:56
i have that xml file : <?xml version="1.0" encoding="utf-8"?> <reminders> <reminder> <Title>Alarm1</Title> <Description>Desc1</Description> <Time>03/07/2012 10:11AM</Time> <snooze>1</snooze> <repeat>None</repeat> </reminder> </reminders> And i want to modify the innertext from Alarm1 to another value so i wrote that code which actually duplicate the entire node . XmlDocument xml = new XmlDocument(); xml.Load("0.xml"); XmlNodeList elements = xml.SelectNodes("//reminders"); foreach (XmlNode element in elements) { if (element.InnerText == "Alarm1") { XmlNode newvalue = xml.CreateElement("MODIFIED

C# extracting data from XML

偶尔善良 提交于 2019-11-29 02:08:20
I'm trying to read weather data from XML in a URL. The XML looks like this: <weatherdata> <location>...</location> <credit>...</credit> <links>...</links> <meta>...</meta> <sun rise="2013-05-11T04:49:22" set="2013-05-11T21:39:03"/> <forecast> <text>...</text> <tabular> <time from="2013-05-11T01:00:00" to="2013-05-11T06:00:00" period="0"> <!-- Valid from 2013-05-11T01:00:00 to 2013-05-11T06:00:00 --> <symbol number="2" name="Fair" var="mf/02n.03"/> <precipitation value="0" minvalue="0" maxvalue="0.1"/> <!-- Valid at 2013-05-11T01:00:00 --> <windDirection deg="173.8" code="S" name="South"/>

Decode CDATA section in C#

十年热恋 提交于 2019-11-29 01:52:23
I have a bit of XML as follows: <section> <description> <![CDATA[ This is a "description" that I have formatted ]]> </description> </section> I'm accessing it using curXmlNode.SelectSingleNode("description").InnerText but the value returns \r\n This is a "description"\r\n that I have formatted instead of This is a "description" that I have formatted. Is there a simple way to get that sort of output from a CDATA section? Leaving the actual CDATA tag out seems to have it return the same way. You can use Linq to read CDATA. XDocument xdoc = XDocument.Load("YourXml.xml"); xDoc.DescendantNodes()

Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function

允我心安 提交于 2019-11-28 22:19:27
I am trying to call SelectNode from XmlDocument class and trouble due to this error: Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function. My code: public void Add(ref XmlDocument xmlFormat, String strName) { XmlDocument dom; XSLTemplate xsl = null; String strPath = ""; XmlNodeList nl; XmlAttribute na; int n; nl = (XmlNodeList)xmlFormat.SelectNodes("//xsl:import/@href",nsm); } and xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="stylesheets/r_adresetiket.xsl" /> <xsl:template match="/"> <xsl

“An object reference is required for the non-static field, method, or property”

强颜欢笑 提交于 2019-11-28 14:50:17
i am stuck with this small problem in my code. I am trying to make small console application which will write into xml document. I have used xmldocument and xmlnode concept. ERROR i am getting is; *An object reference is required for the non-static field, method, or property 'Write_xml.Program.give_node(System.Xml.XmlDocument)' C:\Documents and Settings\Administrator\Desktop\Write_xml\Write_xml\Program.cs* code is okay except 1 error. I am not able to resolve it ,i want somebody to check it and correct it. using System; using System.Collections.Generic; using System.Linq; using System.Text;

No Nodes Selected from Atom XML document using XPath?

这一生的挚爱 提交于 2019-11-28 12:19:08
I'm trying to parse an Atom feed programmatically. I have the atom XML downloaded as a string. I can load the XML into an XmlDocument . However, I can't traverse the document using XPath. Whenever I try, I get null . I've been using this Atom feed as a test: http://steve-yegge.blogspot.com/feeds/posts/default Calling SelectSingleNode() always returns null , except for when I use " / ". Here is what I'm trying right now: using (WebClient wc = new WebClient()) { string xml = wc.DownloadString("http://steve-yegge.blogspot.com/feeds/posts/default"); XmlNamespaceManager nsMngr = new