Search Results

Search found 91 results on 4 pages for 'selectsinglenode'.

Page 3/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Extending DOMDocument and DOMNode: problem with return object

    - by Glauber Rocha
    I'm trying to extend the DOMDocument class so as to make XPath selections easier. I wrote this piece of code: class myDOMDocument extends DOMDocument { function selectNodes($xpath){ $oxpath = new DOMXPath($this); return $oxpath->query($xpath); } function selectSingleNode($xpath){ return $this->selectNodes($xpath)->item(0); } } These methods return a DOMNodeList and a DOMNode object, respectively. What I'd like to do now is to implement similar methods to the DOMNode objects. But obviously if I write a class (myDOMNode) that extends DOMNode, I won't be able to use these two extra methods on the nodes returned by myDOMDocument because they're DOMNode (and not myDOMNode) objects. I'm rather a beginner in object programming, I've tried various ideas but they all lead to a dead-end. Any hints? Thanks a lot in advance.

    Read the article

  • How to modify by loading and saving the same xml file

    - by cynthia hong
    I have a problem with modifying xml file when i first load and then save it with same file path and name. Below is my code. The error is "Access to the path C:\MyApp\Web.config is denied. If i change the path of the xdoc.Save to be different from xdoc.Load, then it will be ok. What is your recommandation to solve this problem? If possible, i need to modify the existing xml file(meaning xml file for loading and saving is the same path). XmlDocument xdoc = new XmlDocument(); xdoc.Load(@"C:\\MyApp\\Web.config"); XmlNode xn = xdoc.SelectSingleNode("//configuration/MyProvider"); XmlElement el = (XmlElement)xn; el.SetAttribute("defaultProvider", "MyCustomValue"); xdoc.Save(@"C:\\MyApp\\Web.config"); Thanks in advance.

    Read the article

  • Select only items in a specific DIV using HtmlAgilityPack

    - by Adam Haile
    I'm trying to use the HtmlAgilityPack to pull all of the links from a page that are contained within a div declared as <div class='content'> However, when I use the code below I simply get ALL links on the entire page. This doesn't really make sense to me since I am calling SelectNodes from the sub-node I selected earlier (which when viewed in the debugger only shows the HTML from that specific div). So, it's like it's going back to the very root node every time I call SelectNodes. The code I use is below: HtmlWeb hw = new HtmlWeb(); HtmlDocument doc = hw.Load(@"http://example.com"); HtmlNode node = doc.DocumentNode.SelectSingleNode("//div[@class='content']"); foreach(HtmlNode link in node.SelectNodes("//a[@href]")) { Console.WriteLine(link.Value); } Is this the expected behavior? And if so, how do I get it to do what I'm expecting?

    Read the article

  • How read value from XmlNode

    - by klerik123456
    I have a Xml file and I try to read value from node Ticket, but my output is still empty. Can somebody help me ? Xml docmunet : <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Header> <TicketHeader xmlns="http://tempuri.org/"> <Ticket> heslo </Ticket> </TicketHeader> </soap:Header> <soap:Body> <test xmlns="http://tempuri.org/"/> </soap:Body> </soap:Envelope> My code : doc= new XmlDocument(); doc.Load(path); XmlNode temp = doc.SelectSingleNode("//Ticket"); textBox3.Text=temp.InnerXml;

    Read the article

  • Get content of XML node using c#

    - by Adam S
    Hi all, simple question but I've been dinking around with it for an hour and it's really starting to frustrate me. I have XML that looks like this: <TimelineInfo> <PreTrialEd>Not Started</PreTrialEd> <Ambassador>Problem</Ambassador> <PsychEval>Completed</PsychEval> </TimelineInfo> And all I want to do is use C# to get the string stored between <Ambassador> and </Ambassador>. So far I have: XmlDocument doc = new XmlDocument(); doc.Load("C:\\test.xml"); XmlNode x = doc.SelectSingleNode("/TimelineInfo/Ambassador"); which selects the note just fine, now how in the world do I get the content in there?

    Read the article

  • How to parse app.config using ConfigurationManager?

    - by Amokrane
    I was using a certain method for parsing my app.config file. Then I was told that using ConfigurationManager is better and simpler. But the thing is I don't know how to do it with ConfigurationManager. My original code looked like this: XmlNode xmlProvidersNode; XmlNodeList xmlProvidersList; XmlNodeList xmlTaskFactoriesList; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("app.config"); xmlProvidersNode = xmlDoc.DocumentElement.SelectSingleNode("TaskProviders"); xmlProvidersList = xmlProvidersNode.SelectNodes("TaskProvider"); foreach (XmlNode xmlProviderElement in xmlProvidersList) { if (xmlProviderElement.Attributes.GetNamedItem("Name").Value.Equals(_taskProvider)) { xmlTaskFactoriesList = xmlProviderElement.SelectNodes("TaskTypeFactory"); foreach (XmlNode xmlTaskFactoryElement in xmlTaskFactoriesList) { if (xmlTaskFactoryElement.Attributes.GetNamedItem("TaskType").Value.Equals(_taskType)) { taskTypeFactory = xmlTaskFactoryElement.Attributes.GetNamedItem("Class").Value; } } } } What would be the equivalent using ConfigurationManager? (Because all I can see is how to get keys not nodes..) Thanks

    Read the article

  • Optional Fields in Infopath; Getting the xml node with VBA

    - by Sunscreen
    Hi all, I use vb to get data through my form. I have some optional fileds in my form and I have this problem with the following code: MsgBox(myXPathNavigator.SelectSingleNode("/my:Status/my:Questions/my:Questions1", _ Me.NamespaceManager).IsNode.ToString) When the optional filed 'Questions1' is inserted to the form I get the value 'true' by the IsNode function. If the field it is not inserted I have an exception, stating that the reference is not correct (and it is indeed true). Is there a way to verify about a node, whether it is present or not in my form? Thanks in advance, Sun

    Read the article

  • Invalid Token when using XPath

    - by Andy5
    Hi I am making a modification to a web application using XPath, and when executed I get an error message - Invalid token! This is basic what I am doing public xmlNode GetSelection (SelectParams params, xmldocument docment) { xpathstring = string.format("Name =\'{0}' Displaytag = \'{1}' Manadatory=\'{2}', params.Name, params.Displaytag, params.Manadatory); return document.selectsinglenode(xpathstring); } As you can see, I am making a string and setting values on the nodes I am trying to find against my xml document, and thus returning xml data that matches my parameters. What is happening is that I am getting an xpathexeception error in Visual Studio and it says invalid token. I do know that in the xml document that the parameters I am looking in the tags have double quotes, for example, Name="ABC". So, I thought the problem could be solved using an "\". Can anyone help? Update from comments In the Xml Document, the tag has attributes where they are set as Name="ABC" Displaytag="ATag" Manadatory="true".

    Read the article

  • Adding element to existing XML node

    - by Sathish
    Where am i going wrong??? I have an xml file with OppDetails as a tag already as shown below <OppDetails> <OMID>245414</OMID> <ClientName>Best Buy</ClientName> <OppName>International Rate Card</OppName> <CTALinkType>AO,IO,MC,TC</CTALinkType> </OppDetails> </OppFact> Now i am trying to add another element to it but getting an error in AppendChild method please help XmlNode rootNode = xmlDoc.SelectSingleNode("OppDetails"); XmlElement xmlEle = xmlDoc.CreateElement("CTAStartDate"); xmlEle.InnerText = ExcelUtility.GetCTAStartDate(); rootNode.AppendChild(xmlEle); xmlDoc.Save("C:\\test.xml");

    Read the article

  • Will I use HtmlDocument even I want to parse the HTML string using HtmlAglityPack ?

    - by skhan
    Hi everyone, I'm working in C#. I'm trying to extract the first instance of img tag from a HTML string (which is actually a post data). This is my code: private string GrabImage(string htmlContent) { String firstImage; HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument(); htmlDoc.LoadHtml(htmlContent); HtmlAgilityPack.HtmlNode imageNode = htmlDoc.DocumentNode.SelectSingleNode("//img"); if (imageNode != null) { return firstImage = imageNode.ToString(); } else return firstImage=" "; } But it gets null in htmlDoc, will I use the HtmlDocument type even if I'm trying to parse the HTML from a string ? P.S btw is it the correct way of grabbing the first instance of image tag from my HTML string?

    Read the article

  • Clearing Only inner text and not the childnodes

    - by Ravisha
    I have an xml as below < Image>ImageValue11 <Type>png<Type> <Value>ImageValue11</ Value> </ Image> Here ImageValue1 is present in two places.I want to remove innerText for Image node which is the parent.For which i am usign below code XmlNode customImageNode = imagedoc.SelectSingleNode("//Image"); customImageNode.InnerText = string.empty; But this is clearing the child nodes as well.Please let me know how to clear this test off .Looking for a generic solution.

    Read the article

  • Get length of a Dictionary

    - by StealthRT
    Hey all i am new at this Dictionary class in VB.net. I am wanting to reteive how many items in the Dictionary array there are: But doing this: Dim showNumber As Integer = tmpShows.Length Does not seem to yield 4 as it should? The code for the Dictionary i have is this: Dim all = New Dictionary(Of String, Object)() Dim info = New Dictionary(Of String, Object)() info!Station = .SelectSingleNode(".//span[@class='channel']").ChildNodes(3).ChildNodes(2).InnerText info!Shows = From tag In .SelectNodes(".//a[@class='thickbox']") Select New With {.Show = tag.Attributes("title").Value, .Link = tag.Attributes("href").Value} Dim tmpShows = all.Item(info!Station) Dim showNumber As Integer = tmpShows.Length What am i missing in order to get the 4 length i am looking for?

    Read the article

  • HTML Agility Pack - ReplaceNode doesn't change the InnerHTML of the Body

    - by morsanu
    Hi there, I have this The body: <body><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent leo leo, ultrices eu venenatis et, rutrum fringilla dolor.</p></body> The code: HtmlNode body = doc.DocumentNode.SelectSingleNode("//body"); Dictionary<HtmlNode, HtmlNode> toReplace = new Dictionary<HtmlNode, HtmlNode>(); // I do some logic here adding nodes to the toReplace dictionary. foreach (HtmlNode replaceNode in toReplace.Keys) { replaceNode.ParentNod.ReplaceChild(toReplace[replaceNode], replaceNode); } After i do this, the InnerHtml of the body node remains the same as from beginning, although the OutterHtml or the InnerText are showing the good result. Is there something wrong with my code? The result: // body.InnerHtml <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent leo leo, ultrices eu venenatis et, rutrum fringilla dolor.</p> // body.OutterHtml <body><p>Lorem ipsum dolor sit amet...</p></body>

    Read the article

  • XAML | When used XamlReader.Parse, not able to refer the items using the LogicalTreeHelper/VisualTre

    - by Roopesh
    Hi, I am setting the dynamic xaml (I am reading the xaml from the DB) for the content of a tab using the below statement. Tab.Content = XamlReader.Parse(xaml, ctx) After setting the content, if I try getting the children using the VisualTreeHelper, but I am not able to get. How ever I dont have this issue when I construct the xaml statically. Here is the code to reading the xaml. Dim XmlDocument = New XmlDataDocument() Dim IID As String = Nothing Dim xaml As String = Nothing Dim Tab As New TabItem Dim TempPanel As XmlNode = Nothing 'Tab.Height = 0 Try XmlDocument.Load(Directory.GetCurrentDirectory & "\Xml\AppFile.xml") pXmlDoc = XmlDocument xaml = XmlDocument.SelectSingleNode("//Grid").OuterXml Dim AsmName As String = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name Dim ctx As ParserContext = New ParserContext() ' New ParserContext() ctx.XamlTypeMapper = New XamlTypeMapper(New String() {AsmName}) ctx.XamlTypeMapper.AddMappingProcessingInstruction("src", "WpfToolkitDataGridTester", AsmName) ctx.XmlnsDictionary.Add("", "http://schemas.microsoft.com/winfx/2006/xaml/presentation") ctx.XmlnsDictionary.Add("x", "http://schemas.microsoft.com/winfx/2006/xaml") ctx.XmlnsDictionary.Add("src", "clr-namespace:WpfToolkitDataGridTester;assembly=" + AsmName) Tab.Name = "Tab" & Grid1Tab.Items.Count + 1 Tab.Header = "AppFile-1" Tab.BorderThickness = New Thickness(0) Tab.IsSelected = True Tab.Content = XamlReader.Parse(xaml, ctx) Grid1Tab.Items.Add(Tab) Return True Catch ex As Exception Throw End Try Here is the code to access the item after constructing the XAML. For i As Integer = 0 To VisualTreeHelper.GetChildrenCount(myVisual) - 1 Dim childVisual As Visual = CType(VisualTreeHelper.GetChild(myVisual, i), Visual) Select Case childVisual.DependencyObjectType.Name Case "ComboBox" AddHandler CType(childVisual, ComboBox).SelectionChanged, AddressOf ComboBox_SelectChanged Case "CheckBox" AddHandler CType(childVisual, CheckBox).Checked, AddressOf CheckBoxClicked AddHandler CType(childVisual, CheckBox).Unchecked, AddressOf CheckBoxClicked Case "RadioButton" AddHandler CType(childVisual, RadioButton).Checked, AddressOf CheckBoxClicked Case "TabControl" For Each item As System.Windows.Controls.TabItem In CType(childVisual, TabControl).Items EnumVisual(item.Content) Next End Select EnumVisual(childVisual) Next i any help is highly appreciated. Thanks,

    Read the article

  • HTML Agility Pack Screen Scraping XPATH isn't returning data

    - by Matthias Welsh
    I'm attempting to write a screen scraper for Digikey that will allow our company to keep accurate track of pricing, part availability and product replacements when a part is discontinued. There seems to be a discrepancy between the XPATH that I'm seeing in Chrome Devtools as well as Firebug on Firefox and what my C# program is seeing. The code I'm currently using is pretty quick and dirty... //This function retrieves data from the digikey private static List<string> ExtractProductInfo(HtmlDocument doc) { List<HtmlNode> m_unparsedProductInfoNodes = new List<HtmlNode>(); List<string> m_unparsedProductInfo = new List<string>(); //Base Node for part info string m_baseNode = @"//html[1]/body[1]/div[2]"; //Write part info to list m_unparsedProductInfoNodes.Add(doc.DocumentNode.SelectSingleNode(m_baseNode + @"/table[1]/tr[1]/td[1]/table[1]/tr[1]/td[1]")); //More lines of similar form will go here for more info //this retrieves digikey PN foreach(HtmlNode node in m_unparsedProductInfoNodes) { m_unparsedProductInfo.Add(node.InnerText); } return m_unparsedProductInfo; } Although the path I'm using appears to be "correct" I keep getting NULL when I look at the list "m_unparsedProductInfoNodes" Any idea what's going on here? I'll also add that if I do a "SelectNodes" on the baseNode it only returns a div... not sure what that indicates but it doesn't seem right.

    Read the article

  • How do I use XML prefixes in C#?

    - by Andrew Mock
    EDIT: I have now published my app: http://pastebin.com/PYAxaTHU I was trying to make console-based application that returns my temperature. using System; using System.Xml; namespace GetTemp { class Program { static void Main(string[] args) { XmlDocument doc = new XmlDocument(); doc.LoadXml(downloadWebPage( "http://www.andrewmock.com/uploads/example.xml" )); XmlNamespaceManager man = new XmlNamespaceManager(doc.NameTable); man.AddNamespace("aws", "www.aws.com/aws"); XmlNode weather = doc.SelectSingleNode("aws:weather", man); Console.WriteLine(weather.InnerText); Console.ReadKey(false); } } } Here is the sample XML: <aws:weather xmlns:aws="http://www.aws.com/aws"> <aws:api version="2.0"/> <aws:WebURL>http://weather.weatherbug.com/WA/Kenmore-weather.html?ZCode=Z5546&Units=0&stat=BOTHL</aws:WebURL> <aws:InputLocationURL>http://weather.weatherbug.com/WA/Kenmore-weather.html?ZCode=Z5546&Units=0</aws:InputLocationURL> <aws:station requestedID="BOTHL" id="BOTHL" name="Moorlands ES" city="Kenmore" state=" WA" zipcode="98028" country="USA" latitude="47.7383346557617" longitude="-122.230278015137"/> <aws:current-condition icon="http://deskwx.weatherbug.com/images/Forecast/icons/cond024.gif">Mostly Cloudy</aws:current-condition> <aws:temp units="&deg;F">40.2</aws:temp> <aws:rain-today units=""">0</aws:rain-today> <aws:wind-speed units="mph">0</aws:wind-speed> <aws:wind-direction>WNW</aws:wind-direction> <aws:gust-speed units="mph">5</aws:gust-speed> <aws:gust-direction>NW</aws:gust-direction> </aws:weather> I'm just not sure how to use XML prefixes correctly here. What is wrong with this?

    Read the article

  • How to delete specific node in omnixml delphi

    - by Erwan
    i've read this answer but i don't know how to use that sample in my case. I have an xml file <Archive> <Source> <Name>321</Name> <BatchID>123</BatchID> </Source> <DataList> <Data> <PN>AAAA</PN> <FN>1111</FN> </Data> <Data> <PN>BBBB</PN> <FN>2222</FN> </Data> </DataList> </Archive> How can i delete the Node that has PN=BBBB? I'm so sorry, i think i'm not clear in my question, my bad, My Question is how to delete this section: <Data> <PN>BBBB</PN> <FN>2222</FN> </Data> not only this section <PN>BBBB</PN> The Answer: Thanks to Runner, i modified a little bit of his code DeleteNode := XMLDoc.DocumentElement.SelectSingleNode('/Archive/DataList/Data[PN="BBBB"]'); DeleteNode.ParentNode.RemoveChild(DeleteNode);

    Read the article

  • XPATH query, HtmlAgilityPack and Extracting Text

    - by Soham
    I had been trying to extract links from a class called "tim_new" . I have been given a solution as well. Both the solution, snippet and necessary information is given here The said XPATH query was "//a[@class='tim_new'], my question is, how did this query differentiate between the first line of the snippet (given in the link above and the second line of the snippet). More specifically, what is the literal translation (in English) of this XPATH query. Furthermore, I want to write a few lines of code to extract the text written against NSE: <div class="FL gL_12 PL10 PT15">BSE: 523395 &nbsp;&nbsp;|&nbsp;&nbsp; NSE: 3MINDIA &nbsp;&nbsp;|&nbsp;&nbsp; ISIN: INE470A01017</div> Would appreciate help in forming the necessary selection query. My code is written as: IEnumerable<string> NSECODE = doc.DocumentNode.SelectSingleNode("//div[@NSE:]"); But this doesnt look right. Would appreciate some help.

    Read the article

  • C# CreateElement method - how to add an child element with xmlns=""

    - by NealWalters
    How can I get the following code to add the element with "xmlns=''"? using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string strXML = "<myroot>" + " <group3 xmlns='myGroup3SerializerStyle'>" + " <firstname xmlns=''>Neal3</firstname>" + " </group3>" + "</myroot>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(strXML); XmlElement elem = xmlDoc.CreateElement(null, "lastname", null); elem.InnerText = "New-Value"; string strXPath = "/myroot/*[local-name()='group3' and namespace-uri()='myGroup3SerializerStyle']/firstname"; XmlNode insertPoint = xmlDoc.SelectSingleNode(strXPath); insertPoint.AppendChild(elem); string resultOuter = xmlDoc.OuterXml; Console.WriteLine("\n resultOuter=" + resultOuter); Console.ReadLine(); } } } My current output: resultOuter=<myroot><group3 xmlns="myGroup3SerializerStyle"><firstname xmlns="" >Neal3<lastname>New-Value</lastname></firstname></group3></myroot> The desired output: resultOuter=<myroot><group3 xmlns="myGroup3SerializerStyle"><firstname xmlns="" >Neal3<lastname xmlns="">New-Value</lastname></firstname></group3></myroot> For background, see related posts: http://www.stylusstudio.com/ssdn/default.asp?fid=23 (today) http://stackoverflow.com/questions/2410620/net-xmlserializer-to-element-formdefaultunqualified-xml (March 9, thought I fixed it, but bit me again today!)

    Read the article

  • HttpUtility.HtmlDecode driving me crazy!!!!

    - by Savvas Sopiadis
    Hi everybody! This situation is driving me crazy!!: the following snippet does not work (as i should) ... string preResult = doc.DocumentNode.SelectSingleNode("//textarea[@name='utrans']").InnerText return HttpUtility.HtmlDecode(preResult); ... The first line assigns a value (e.g.) "&lt;b&gt; Dummy value: &lt;/ b&gt; into preResult (that's expected). BUT the next line gives AGAIN the same value!!! But it should return "<b> Dummy value: </ b>". Debugging these lines i thought to copy and paste the value directly into HttpUtility.HtmlDecode() and guess what...it worked!!! I got the expected value! Of course this is useless, but it proves something weird is going on...what?!! Has anybody faced the same situation again? (dev.env. VS2008,.NET3.5SP1) Thanks in advance

    Read the article

  • Getting "" at the beginning of my XML File after save()

    - by Remy
    I'm opening an existing XML file with c# and I replace some nodes in there. All works fine. Just after I save it, I get the following characters at the beginning of the file:  (EF BB BF in HEX) The whole first line: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> The rest of the file looks like a normal XML file. The simplified code is here: XmlDocument doc = new XmlDocument(); doc.Load(xmlSourceFile); XmlNode translation = doc.SelectSingleNode("//trans-unit[@id='127']"); translation.InnerText = "testing"; doc.Save(xmlTranslatedFile); I'm using a C# WinForm Application. With .NET 4.0. Any ideas? Why would it do that? Can we disable that somehow? It's for Adobe InCopy and it does not open it like this. UPDATE: Alternative Solution: Saving it with the XmlTextWriter works too: XmlTextWriter writer = new XmlTextWriter(inCopyFilename, null); doc.Save(writer);

    Read the article

  • How to write CData in xml

    - by Rajesh Rolen- DotNet Developer
    i have an xml like : <?xml version="1.0" encoding="UTF-8"?> <entry> <entry_id></entry_id> <entry_status></entry_status> </entry> i am writing data in it like: XmlNode xnode = xdoc.SelectSingleNode("entry/entry_status"); xnode.InnerText = "<![CDATA[ " + Convert.ToString(sqlReader["story_status"]) + " ]]>" ; but its change "<" to "&lt" of CDATA. Please tell me how to fill values in above xml as a CData format. i know that we can create CDATA like : XmlNode itemDescription = doc.CreateElement("description"); XmlCDataSection cdata = doc.CreateCDataSection("<P>hello world</P>"); itemDescription.AppendChild(cdata); item.AppendChild(itemDescription); but my process is to read node of xml and change its value not to append in it. Thanks

    Read the article

  • Parsing XML in C# from stream

    - by Phillip
    I've tried several methods, from Linq to loading the data to an XML document, but i can't seem to be able to return the result that i need. here's the example XML: <serv:message xmlns:serv="http://www.webex.com/schemas/2002/06/service" xmlns:com="http://www.webex.com/schemas/2002/06/common" xmlns:event="http://www.webex.com/schemas/2002/06/service/event"><serv:header><serv:response><serv:result>SUCCESS</serv:result><serv:gsbStatus>PRIMARY</serv:gsbStatus></serv:response></serv:header><serv:body><serv:bodyContent xsi:type="event:createEventResponse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><event:sessionKey>11111111</event:sessionKey><event:guestToken>111111111111111111111</event:guestToken></serv:bodyContent></serv:body></serv:message> And, here's what i've tried to do: StreamReader reader = new StreamReader(dataStream); XmlDocument doc = new XmlDocument(); doc.LoadXml(reader.ReadToEnd()); XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable); XmlNamespaceManager ns2 = new XmlNamespaceManager(doc.NameTable); XmlNamespaceManager ns3 = new XmlNamespaceManager(doc.NameTable); ns.AddNamespace("serv", "http://www.webex.com/schemas/2002/06/service"); ns2.AddNamespace("com", "http://www.webex.com/schemas/2002/06/common"); ns3.AddNamespace("event", "http://www.webex.com/schemas/2002/06/service/event"); XmlNode node = doc.SelectSingleNode("result",ns); Yet, for some reason i cannot ever seem to return the actual result, which should be either 'SUCCESS' or 'FAILURE' based on the actual xml above. How can i do this?

    Read the article

  • Update Azure Service Configuration File using Powershell

    - by David Osborn
    I'm trying to write a powershell script that updats each of the DiagnosticsConnectionString and DataConnectionString values below, but I can't seem to find each individual Role node using $serviceconfig.ServiceConfiguration.SelectSingleNode("Role[@name='MyService_WorkerRole']") doing echo $serviceconfig.ServiceConfiguration.Role lists out both Role nodes for me so I know it is working up to that point, but after that I am not having much success. where $serviceConfig contains the below XML: <?xml version="1.0"?> <ServiceConfiguration serviceName="MyService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"> <Role name="MyService_WorkerRole"> <Instances count="1" /> <ConfigurationSettings> <Setting name="DiagnosticsConnectionString" value="really long string" /> <Setting name="DataConnectionString" value="really long string 2" /> </ConfigurationSettings> </Role> <Role name="MyService_WebRole"> <Instances count="1" /> <ConfigurationSettings> <Setting name="DiagnosticsConnectionString" value="really long string 3" /> <Setting name="DataConnectionString" value="really long string 4" /> </ConfigurationSettings> </Role> </ServiceConfiguration>

    Read the article

  • deleting entire xml node with datagrid

    - by DuranL
    Hello, I have the following xml structure: <systemtest> <test id="0"> <name>Test One</name> </test> <test id="1"> <name>Test Two</name> </test> </systemtest> The name gets displayed in the 1ste colum of the datagrid, where in the 2nd colum there is a buttoncolumn with delete button. How exactly can i use xpath and navigate to the current node lets say with test id="0" and delete it (including name)? Its unclear how i can say to this method what row he has to delete exactly. XmlDocument XMLDoc = new XmlDocument(); XMLDoc.Load(XMLFile); XPathNavigator nav = XMLDoc.CreateNavigator(); nav.SelectSingleNode("...."); //?? nav.DeleteSelf(); //will this do the trick? Also the id gets generated in a seperate class where the above method should be. Thanks in advance.

    Read the article

< Previous Page | 1 2 3 4  | Next Page >