xmlnode

Parsing XML in Python using Expat

Background: I'm coming from C#-land, so I'm looking for something like being able to handle nodes and values by selecting via Xpath. Here's my code, so far: import urllib import sys from xml.parsers import expat url = 'http://SomeWebService.SomeDomain.com' u = urllib.urlopen(url) Parser = expat.ParserCreate() data = u.read() try: ...

Convert XmlDocument object into an XmlNode object - C#?

How do I convert an XmlDocument to a XmlNode in C#? I need to send the entire XmlDocument object to as an input parameter to a .NET web service. ...

Trying to use RemoveChild() on XmlNodeList messes up my XmlNode collection

Hi there, I'm trying to remove a specific node from a XmlNodeList named listaWidths. This specific list has 5 items before I use RemoveChild(). But, after the RemoveChild() statement, the list stays only with 1 item. XmlNodeList listaWidths = xmlDoc.SelectNodes("/MsBuild:Report/MsBuild:Body/MsBuild:ReportItems/MsBuild:Tablix/MsBuild:Ta...

Modify XML existing content in C#

Purpose: I plan to Create a XML file with XmlTextWriter and Modify/Update some Existing Content with XmlNode SelectSingleNode(), node.ChildNode[?].InnerText = someting, etc. After I created the XML file with XmlTextWriter as below. XmlTextWriter textWriter = new XmlTextWriter("D:\\learning\\cs\\myTest.xml", System.Text.Encoding.UTF8); ...

How to modify exiting XML file with XmlDocument and XmlNode in C#

I already implemented to create the XML file below with XmlTextWriter when application initialization. And know I don't know how to update the childNode id value with XmlDocument & XmlNode. Is there some property to update the id value? I tried InnerText but failed. thank you. <?xml version="1.0" encoding="UTF-8"?> <Equipment xmlns...

XML and .NET: How to replace specific node with many other ones loaded from raw xml data

Let's suppose we have an element like this one in the main xml file: <group name="gr1" filename="groups/gr1.xml"/>. The second file gr1.xml contains something like this: <item name="i1">Item one</item> <item name="i2">Item two</item> <item name="i3">Item three</item> Note that there is no XML declaration in gr1.xml, just plain items w...

XmlNode.RemoveChild() recursive

Hi, my problem is the following: How can I remove selected ChildNodes from XmlNode recursively? My XML-file looks like... ..<element type="TextBox" id="xslFilePath"> <parameters> <parameter id="description"> <value><![CDATA[Pfad zur XSL]]></value> <valu...

is there any easy wasy to convert the XML output from sharepoint GetListItems() to a DataTable

i am able to retrieve data from sharepoint com.sharepoint2.Lists lists = new Lists(); lists.Credentials = new System.Net.NetworkCredential("user", "pwd", "domain"); lists.Url = "http://sharepoint2.company.com/sites/mysite/_vti_bin/Lists.asmx"; XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element, "Query", ""); XmlNode ndViewField...

XmlNodes stripping out HTML

Got some html with javascript in, the javascript creates an MSXml2 object and loads some XML from a file, and populates a span. However the HTML that's within the XML is being stripped. Is there a way to stop it from doing this? (pseudocode) I've tried various combinations of mySpan = blah.GetNode("mynode").text , .value, .innerxml etc....

How to test if a XML element has a text element inside?

Hello folks, I would like to know how could I test the fallowing situation: <foo> <bla1>xxx</bla1> <bla2>yyy</bla2> <bla3>zzz</bla3> </foo> In the while(reader.Read()), I drop in the XmlNodeType.Element when I'm in the foo and bla1, bla2, bla3... When drop in the .TextElement in the xxx, yyy, zzz. But can I test if the bl...

How can i select specific childnodes with LINQ?

I have a node and this node contains 5 childnodes. three of them is RatePlan. How can i select those RatePlan childnodes with LINQ? Lets clarify something : my xml is like this : <hotels> <hotel id="1" name="hotel 1"> <telephone>123456789</telephone> <fax>123</fax> <address>hotels address</address> <hotelRatePlan>10<...

insert XmlDocument into a XmlDocument node

I created a basic XmlDocument with one node: XmlDocument bigDoc = new XmlDocument(); bigDoc.LoadXml("<Request></Request>"); and I'm getting another XmlDocument that I want to insert inside <Request> node. It doesn't work for me: XmlNode requestNode = bigDoc.FirstChild; requestNode.AppendChild(anotherXMLDocument); It thorows an e...

How to load an XmlNode object ignoring undeclared namespaces?

I want to load up an XmlNode without getting an XmlException when an unrecognized namespace is present. The reason is because I need to pass an XMLNode instance to a method. I'm loading up arbitrary XML fragments having namespaces out of their original context (e.g. MSWord formatting and other software products with various schemas t...

Can XmlReader parse out distinct entity references?

My XmlReader instance created by factory method XmlReader.Create(..) is including entity references along with surrounding text into one complete blurb of type XmlNodeType.Text (It's actually unescaping the entities into the text). For example if the XML source contains <div>this &amp; that</div> XmlReader will parse out readerInstanc...