Click here to Skip to main content
15,891,409 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to fix a menustrip ? Pin
ShermansLagoon13-Feb-07 7:13
ShermansLagoon13-Feb-07 7:13 
Question.NET 2.0 UserControl Adorners Override Please Help!! Pin
@FrankDrebin@12-Feb-07 12:56
@FrankDrebin@12-Feb-07 12:56 
QuestionHow to set node value in XMLDocument [modified] Pin
AndrusM12-Feb-07 12:51
AndrusM12-Feb-07 12:51 
AnswerRe: How to set node value in XMLDocument Pin
gauthee12-Feb-07 17:01
gauthee12-Feb-07 17:01 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 1:50
AndrusM13-Feb-07 1:50 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz13-Feb-07 6:19
Stefan Troschuetz13-Feb-07 6:19 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM13-Feb-07 8:48
AndrusM13-Feb-07 8:48 
GeneralRe: How to set node value in XMLDocument [modified] Pin
Stefan Troschuetz13-Feb-07 9:19
Stefan Troschuetz13-Feb-07 9:19 
Ok, first of all here is the link to the MSDN topic with the example: XmlNode.SelectSingleNode Method (String, XmlNamespaceManager)[^]
To make it easier for you here is the example given there:
<bookstore xmlns="http://www.lucernepublishing.com">
 <book>
   <title>Pride And Prejudice</title>
 </book>
</bookstore>

The following C# code selects the first book node:

XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("ab", "http://www.lucernepublishing.com");
XmlNode book = doc.SelectSingleNode("//ab:book", nsmgr);


Your procedure does not work because your XPath expression is still looking for unqualified elements. Xpath does not offer an default namespace feature as XML files, at least I do not know of such a feature. Therefore, you have to prefix all element names with a specific prefix that maps to the right namespace URI (this mapping is what the namespace manager is for). Since your XML file makes use of a default namespace, it's quite likely that passing documents name table is not sufficient and you are required to add a prefix-namespaceUri-mapping as shown in the example.
[edit]
I was right :-> MSDN states:
"If the XPath expression does not include a prefix, it is assumed that the namespace URI is the empty namespace. If your XML includes a default namespace, you must still add a prefix and namespace URI to the XmlNamespaceManager; otherwise, you will not get a node selected. For more information, see Select Nodes Using XPath Navigation[^]."
[/edit]

AndrusM wrote:
Where to download complete .NET + C# documentation for fast offline view ?


Some days ago, someone posted in this forum that you cannot download the documentation for free. You can get it on DVD, but for this you need a MSDN subscription for some hundred dollars if i recall the posting right.

AndrusM wrote:
After I press F1 key, it takes 1-2 minutes for documentation viewer to open


Maybe, you can speed this up. Open the options of Visual Studio (available under menu item "extras"). Then go to "environment>help>online". At the top edge, you can define where Visual Studio looks for the requested help first. By default, it first tries to lookup online, what may be the reason for the long delay.


-- modified at 16:28 Tuesday 13th February, 2007


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook

www.troschuetz.de

GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 6:18
AndrusM14-Feb-07 6:18 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 7:36
Stefan Troschuetz14-Feb-07 7:36 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 9:23
AndrusM14-Feb-07 9:23 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 9:59
Stefan Troschuetz14-Feb-07 9:59 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM14-Feb-07 10:23
AndrusM14-Feb-07 10:23 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz14-Feb-07 21:13
Stefan Troschuetz14-Feb-07 21:13 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 6:43
AndrusM15-Feb-07 6:43 
GeneralRe: How to set node value in XMLDocument Pin
Stefan Troschuetz15-Feb-07 7:32
Stefan Troschuetz15-Feb-07 7:32 
GeneralRe: How to set node value in XMLDocument Pin
AndrusM15-Feb-07 8:13
AndrusM15-Feb-07 8:13 
QuestionConvert DataReader to Entity list Pin
AndrusM12-Feb-07 12:49
AndrusM12-Feb-07 12:49 
QuestionCrystal Report WebService Report to DataSet Pin
dbambirck12-Feb-07 12:36
dbambirck12-Feb-07 12:36 
QuestionCopy value from that table adapter to data grid cell, how? Pin
TrooperIronMan12-Feb-07 12:33
TrooperIronMan12-Feb-07 12:33 
AnswerRe: Copy value from that table adapter to data grid cell, how? Pin
TrooperIronMan12-Feb-07 14:19
TrooperIronMan12-Feb-07 14:19 
GeneralRe: Copy value from that table adapter to data grid cell, how? Pin
TrooperIronMan14-Feb-07 1:38
TrooperIronMan14-Feb-07 1:38 
QuestionHow can I have a Panel in my WindowForm? Pin
Khoramdin12-Feb-07 12:05
Khoramdin12-Feb-07 12:05 
AnswerRe: How can I have a Panel in my WindowForm? Pin
Ed.Poore12-Feb-07 12:23
Ed.Poore12-Feb-07 12:23 
QuestionOrphan Processes Pin
convivial.developer12-Feb-07 11:40
convivial.developer12-Feb-07 11:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.