Xpath Newbie Mistake, Please Help!

This code throws an exception when it should just print "C$" to the screen.
What is messed up in my xpath?

Thanks.


test.cs:
using System;
using System.Xml;
using System.IO;

class XmlReadSimple
{
  [STAThread]
  static void Main(string[] args)
  {
    XmlDocument xmlDocument = new XmlDocument();
    xmlDocument.Load(
      Path.GetDirectoryName(System.Reflection.Assembly.
        GetExecutingAssembly().Location) + "\\test.xml" );
    System.Xml.XmlNode xmlNode = xmlDocument.SelectSingleNode(
      "///[@path='c:\']/@name"
      );
    Console.WriteLine( xmlNode.InnerText.ToString() );

  }
}


text.xml:
<?xml version="1.0" encoding="utf-8" ?> 
<paths>
	<share name="C$" path="c:\" />
</paths>
0
11/6/2003 9:37:22 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
370 Views

Similar Articles

[PageSpeed] 26

///[@path='c:\']/@name

should be

//[@path='c:\']/@name

Joe Feser

"bdwise" <bradwiseathome@hotmail.com> wrote in message
news:59c05c40.0311061337.2a3de9cf@posting.google.com...
> This code throws an exception when it should just print "C$" to the
screen.
> What is messed up in my xpath?
>
> Thanks.
>
>
> test.cs:
> using System;
> using System.Xml;
> using System.IO;
>
> class XmlReadSimple
> {
>   [STAThread]
>   static void Main(string[] args)
>   {
>     XmlDocument xmlDocument = new XmlDocument();
>     xmlDocument.Load(
>       Path.GetDirectoryName(System.Reflection.Assembly.
>         GetExecutingAssembly().Location) + "\\test.xml" );
>     System.Xml.XmlNode xmlNode = xmlDocument.SelectSingleNode(
>       "///[@path='c:\']/@name"
>       );
>     Console.WriteLine( xmlNode.InnerText.ToString() );
>
>   }
> }
>
>
> text.xml:
> <?xml version="1.0" encoding="utf-8" ?>
> <paths>
> <share name="C$" path="c:\" />
> </paths>


0
nntp2183 (21)
11/6/2003 10:41:46 PM
Reply:

Similar Artilces:

My Exchange 5.5 is relaying encapsulated messages HELP!
My Exchange 5.5 server appears to be relaying encapsulated messages. On the "routing" tab of the IMC, I have it set to "re-route SMTP mail..." but on the "routing restrictions" button I have every single item UNCHECKED. Also, I have rebooted the server. I heard that you have to disable encapsulated relaying via the registry, but I can't seem to find the article on Microsoft's site. Can anyone help?? Uncehck re-route SMTP mail. If you have POP or IMAP users who need an SMTP IMC to relay mail, for their use install an IMC on a separate Exchagne 5.5 s...

Adding multiple products to a contact: Challenge/HELP!!!
Here is a challenge: We sell products ( traing courses) where we have to be able to link a contact to a product. thanks to Andrew on the message "Mapping between standard and custom entity" we were able to do that using the ideas he posted. as well as his blog. (http://andrewn23.blogspot.com/) What we now run into is that we can have multiple courses on a single quote/order and want to associate the contact/stuent easily with the products. when one wants to for instance merge accounts there is the possibility for selecting multiples by usng the control key and then clicking ...

Advanced Filter help
Hi All I'm trying to filter a list using advanced filter. The problem i'm having is that i'm picking up records i do not want, even if i use the unique record check box. let me give you an example! My record i want to pick up is code: 009/04025, however it seems to give me all codes starting with 009/04025 eg 009/04025C, 009/04025CG, 009/04025SD etc. The only item i want filtered is 009/04025. Is there maybe a wildcard or something i should be using?? Thx Anthony Set up a criteria range, say X1:X2, where X1 houses the label heading the codes and X2 the formula: ="=009/...

HEEEELLLLPPPP PLEASE!
Hi, I'm running Exchange 2003 SP1 with the latest post SP1 patch applied. Client is Outlook XP. Windows 2003 native domain. In one site (which has recently been migrated from NT4 and Exchange 5.5) I have the following problem but only for some users: When they logon to their mailbox through OWA, they can read, send mail correctly, add contacts, tasks etc... but when they go to their calendar they are unable to create new appointments and the "new" button is not available. They can see the appointments in the calender but are unable to create new ones. Here's what ...

Need help with a function
Hi I'm sorry but I'm not too much familiar with Excel. I have some listing in column A For example in A1 I have: D:\blabla\folder1\file1.xxx in A2 I have: D:\blabla\folder2\file2.xxx in A3 I have: D:\blabla\folder3\file3.xxx I want the word between the 2nd and 3rd '\' to be in color red. So in A1 folder1 should be in red, in A2 folder2 in red etc I could do it manually but there are like 3000 lines. It would take forever. Is this simple to achieve with a script/macro/? ? I hope someone can help me. Thanks in advance. Christophe Presumably you want to pick that value o...

Open File Dialog Help
I am trying to set the m_ofn.lpstrInitialDir to "My Music" on an open file dialog, but can't seem to get it to work right. I would like it to default to the c:\documents and settings\user\My Documents\My Music, regardless of the machine the application is running on. The project is being built using Visual C++ 6.0 Professional, on a Windows 2K machine, but may be running in any Windows environment. Thanks, SHGetSpecialFolderPath(CSIDL_PERSONAL) gets you to My Documents ...

HELP!! Exchange 2003 and rules in outlook
Hi, When I define a rule in outlook2003 for a mailbox on a Exchange 2003 which defines that a mail should be forwarded to an external email address it doesn't work. Nothing can be found of it in message tracking. However, if I define a email address inside the organisation on that same rule it works without problems and I can see the full details in message tracking. I tried creating a contact with the external address (a hotmail address for example) and defining it in the rule but that doesn't work either. Any clues? Thanks Glenn Here's an alternate way of achieving t...

I need help assigning a value to a character
I need to format a cell so that if I enter an upper case "Y" it display the "Y" but the cell thinks the value of the "Y" is "1" so that it ca be added in another function elsewhere. I have tried to use the "IF functions but have had no success as of yet. HELP -- billybo ----------------------------------------------------------------------- billybob's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2661 View this thread: http://www.excelforum.com/showthread.php?threadid=39881 in cell a11 type in =SUM(IF(A1:A10=...

Re:Help with verifying the signature of enveloped -message using x509 certificates.
Re:Help with verifying the signature of enveloped -message using x509 certificates. Hey Friends, I have an xml given by our partner trying to integrating with us and i have their certificate with public key installed in both personal and trusted people folders. when i am using the following code to check the signature of message signed by my certificate i am able to verify the signature but when i am trying to check the signature of the message of our partner using the same following code i am not able to verify the message. the message sent by our partner is right below the code.I wou...

Help please #8
This is a multi-part message in MIME format. ------=_NextPart_000_0016_01C6D1D3.B9AB1720 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I'm having this error message. Event Type: Error Event Source: MSExchangeAL Event Category: Service Control=20 Event ID: 8231 Date: 9/6/2006 Time: 4:39:10 PM User: N/A Computer: MAIL Description: Permanent failure reported by policy group provider for 'CN=3DSystem = Policies,CN=3DDOMAIN,CN=3DMicrosoft = Exchange,CN=3DServices,CN=3DConfiguration,DC=3DDOMAIN,DC=3Dcom':'MAD.EXE'= ,...

VBA Help #6
I know this is simple so I apologize for posting it. I'm looking for the VBA code to take a sheet and sort the rows (below row 2) by a certain column, descending. After sorting, I want Excel to provide shading in alternating rows. For example: Row 2 - no shading Row 3 - Shading Row 4 - no shading Row 5 - shading. Thanks in advance for the help. On Jan 25, 10:47=A0am, SHalper <scott.m.hal...@gmail.com> wrote: > I know this is simple so I apologize for posting it. =A0I'm looking for > the VBA code to take a sheet and sort the rows (below row 2) by a > certain column,...

Please help with contacts and address book
I am using Outlook 2000 and have two sets of folders: 1. Outlook Today - [Mailbox - My Name] 2. Personal Folders The first folder is my link to Exchange Server. When I click on New Mail Message and click on Address Book, the list of addresses I see is from Contacts located under Personal Folders. I have two questions: 1. How do I get the Address Book to list my Outlook Today (Exchange Server) contacts? 2. How do I back up or synchronize my Outlook Today contacts so both contact lists (Outlook Today and Personal Folders) are the same? Thanks, Peter ...

Barcodes Code
I am trying to print a barcode in the 128 code. Though it seems the public domain/GPL ones of the truetype do not print a scanable barcode. Is there any suggestions... Or if anyone can point me into the right direction on how to do this or point me in direction of one that will work with access or excel 2000 or 2003. Much appreciated. Or help me figure out WHY it isnt producing a readable one in 128.. Hi Lester, Perhaps the problem is with the resolution on your printer. Try printing the barcode larger. Perhaps even turn off print to fit under print, page setup. --- HTH, David McRi...

Rules / Macro? Help
This is a multi-part message in MIME format. ------=_NextPart_000_0042_01C478A8.C4D615E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello. This is what I would like to do. If the subject line of the e-mail I = just received reads " Cat " then I would like Outlook to automatically = send/forward the " Cat Template ". If the subject line of the e-mail I = just received reads " Dog " then I would like Outlook to automatically = send/foard the " Cat Template ". I've looked into trying to ...

Sintax Help!
I would like to print a sheet and a graph from a macro. I would like to call both by the Number and not the Name of each. In other words if the sheet was named Chart10 (BoxTops)I need to be able to call the sheet by "Chart10" not "boxtops". This way if the name changes the macro will still work. Somthing like... Sub test() ' ' test Macro ' Macro recorded 5/23/2005 by ' 'Print Chart Sheets("chart12").Select ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True End Sub But my macro errors out on the first line. How to you c...

Calculated Columns Help
FIND/SEARCH functions both return #DEFAULT! if string is not found. If it is not found, I'd like to display a different value (one of the other columns). All my attempts to check if the calculated column = "#DEFAULT!" fail. It is as if it is not really a string. How can I test for #DEFAULT! value? ...

Pivot Table Help #2
- Automaticly Refreshing Pivot Table Data I have a made a macro called "depsub" that gathers sales data from each one of our sales departments, compiles it onto one page, sorts it and SUBTOTALs the data by employee and department. I also have a PivotTable that needs to use this same data. PivotTables can not be generated from subtotaled data. So I have to nest a macro within my "depsub" macro that generates a PivotTable prior to the data being subtotaled. Problem is every time I try to do this the macro errors out and stops when I try to creat the pivot table. Here i...

Recipient Policy help #3
I updated our recipient policy to add a new SMTP domain to everyone's mailbox, it all looked great until I noticed it added the domain to our contacts in the reciepient OU too. Now these external contacts include another smtp address with our domain name. How can I get rid of these? Use admodify to bulk remove them. http://www.gotdotnet.com/workspaces/workspace.aspx?id=f5cbbfa9-e46b-4a7a-8ed8-3e44523f32e2 James Chong Gonzo wrote: > I updated our recipient policy to add a new SMTP domain to everyone's > mailbox, it all looked great until I noticed it added the domain t...

Help needed please
I am running Exchange 2003 with Outlook 2002 as the client connection. On a couple of machine it has not been possible to send mails. When mails are sent to this machine from the Internet, they are received but those sent from the internal exchange do not get delivered. When the user connect through Outlook Web Access, the mails are sitting there. I have tried to reinstall Outlook a number of times but all I get when I click Send/Receive mail from the exchange server is this error message: "The operation failed due to a registry or installation problem. Restart Outlook and try ag...

can someone help with this error?
Error: "The form required to view this message can not be displayed. Contact your administrator" One of my users gets this error when trying to open an email that originated from a yahoo web based email account. In her outlook inbox the email contains an attatchment to each forwarded message. It is when clicking to open the forwarded message that the error occurs. Note that this same email opens fine on other computers using the same version of Outlook. The 'original' message is several 'forwarded' messages deep and contains pictures. When I look at it my title bar ...

Services won't stop! HELP!
I do offline backups of all our remote Exchange 2003 servers. A batch file is run with a series of "net stop" commands the shuts down all the Exchange services, and then kicks off the backup. I just noticed that the batch file is no longer able to stop most of the services! When i run it manually, it just says "The xyz service is stopping........................" The "....." just keep going and going and the service never stops. What could cause this?? On Thu, 9 Mar 2006 14:41:29 -0500, "jim" <jim@NOSPAM.com> wrote: >I do offline ...

Help: Unread message indicator lost in ShortCut (Outlook 2000)
This used to work fine. The number of unread messages used to show up by the name of the folder in the shortcut bar; e.g., Inbox (3). For some reason it all disappeared. The folder list still shows the numbers in parentheses beside the name, but the shortcut bar doesn't. Even I delete the one in the shortcut and copy (re-copy) the folder over it won't work. I'm using XP Pro (upgraded from Home) and Outlook 2000. Help is appreciated. T. J. Fan ...

Please help Sync problem: Windows Live Mail Error ID: 0x80191002
Since two weeks ago each time I try to sync my messages in Windows Live Mail with my Hotmail account I get the following error: Unable to send or receive messages for the Hotmail (XXXXXXX) account. To send and receive messages in your Hotmail account, go to http://hotmail.live.com on the Web, or try again later. To get help from Windows Live Customer Support, go to http://support.live.com and click Windows Live Mail in the list of services. Server Error: 0x80191002 Server: 'http://mail.services.live.com/DeltaSync_v2.0.0/Sync.aspx' Windows Live Mail Error ID: 0x80191002 ...

HELP!!! 08-30-03
please elp me. my mom is a medical transcriber and she has a dictionary she uses through windows 98. and her comp has no memory, so we need to update her operating system inoder to put more memory on there. she needs her dictionary and i was wandering how to access it and if possible how to save it on to a cd. thank you for ur time Dear jason you have to have a dictornary corect i have one i could email you if you like just email me back i mean i use this dictornary really well and it works for 95-Xp so if you want give me a hollar ok peace out danny "jason" <jasonr_206@hotm...

Help with Live SkyDrive
Sorry if this is't the apropiate group, but I haven't found a propoer group for my cuestion .... Anyone can help me ? I send a link to the album but I mark It's not required under the Windows login ID to view the album. If the person you send the link visit the page with Internet Explorer goes correctly, but if you use another browser asks for the Windows ID. Thanks !! If the recipient of the invite is not using IE, iirc, you will have to set the folder permission to 'Everyone or place it in the Public folder(which is preset to Everyone) -- ...winston ms-...