|
Works fine for me. Maybe you are loading the wrong XML file? This is the code I used.
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlNodeList list = doc.DocumentElement.SelectNodes("/bookstore/book/price[text()='11.89']");
Console.WriteLine(list.Count);
and this is the XML file I used
<bookstore>
<book>
<price>11.99</price>
<author>X</author>
<title>Z</title>
</book>
</bookstore>
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi Senthil,
I say you thank you for your reply!!! )))
I still have a problem; if i have a document named book.xml in C:\ this code i wrote doesn't work
XmlTextReader reader = new XmlTextReader(@"c:\book.xml");
XmlDocument doc = new XmlDocument();
doc.Load(reader);
XmlNodeList nodeList;
XmlElement root = doc.DocumentElement;
// nodeList = root.SelectNodes("/bookstore/book/price[text()>'9.00']"); <-- this query works
nodeList = root.SelectNodes("/bookstore/book/price[text()='11.99']"); // <-- this query doesn't work
Console.Write(nodeList.Count.ToString());
if i can't solve this problem my work doesn't go on
|
|
|
|
|
Well, the only thing I can think of is that your XML file might be different. Did you make sure it's exactly the same as you posted?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
oh my god i found the problem...
there was an error in the xml...and i spent more than 4 hours on this problem...
thank you Senthil
|
|
|
|
|
Could someone help me with showing three summary rows on the footer of the datagrid. I need to calculate sales total for and individual.
Then the total for all the sales assistance and lastly
the grand total for the whole department.
Any ideas
|
|
|
|
|
Hi,
I'm trying to create a log file in my application folder.
Have tried:
just "Applog.txt"
"..\Applog.txt"
"\Applog.txt"
"\\Applog.txt"
With no luck.
But if I do
"c:\\Applog.txt"
that works fine.
So what can I use to get the applog in my application folder.
Is there a function return the location from the assembly?
Regards
|
|
|
|
|
|
Have you tried @".\Applog.txt"
I always do as Senthil suggested:
string fileSpec = string.Format("{0}{1}Applog.txt", Application.StartupPath, Path.DirectorySeparatorChar);
|
|
|
|
|
Hi
Please Help in this situation
I have created an application to draw a image that contains Rectangles and others as a images. I just add them in the Picture box. I have completed up to creating the images but the problem comes when i want to rotate the images using the mouse. Not by using the angles given to text boxes. We have to predict the mouse movements and then we have to find the angle of the rotation for that angle we have to rotate the object. Is there any specific algorithm for that. I just have the contrl to the picture box.
With Luv,
Arun R.
-- modified at 7:44 Thursday 10th November, 2005
|
|
|
|
|
Hi
Please Help in this situation
I have created an application to draw a image that contains Rectangles and others as a images. I just add them in the Picture box. I have completed up to creating the images but the problem comes when i want to rotate the images using the mouse. Not by using the angles given to text boxes. We have to predict the mouse movements and then we have to find the angle of the rotation for that angle we have to rotate the object. Is there any specific algorithm for that. I just have the contrl to the picture box.
With Luv,
Arun R.
|
|
|
|
|
Hi!
I'm using Measurement Studio 7.1.
I have the problem to get a rectangle into a graph which shows
measurement data.
This rectangle should be as scrollable and zoomable as the
graph but my rectangle i insert is fix on the screen.
e.Graphics.DrawRectangle(new Pen(Color.Turquoise,2),10,10,50,50);// works!!! but without scrolling and zooming
Hope you can help me.
M.Friedel
|
|
|
|
|
I want to delete Temporary Internet Files, Cookie, and History by using C#.
However, the sample etc. were not found though I searched the Internet.
Please teach when you have the sample and information.
|
|
|
|
|
hello
i tried getting my old project that deals with processes into the new shiny c# 2005 and when i try running i get access denied from the 'System Idle Process' Process object when i try pulling the data out of TotalMilliseconds value (it worked just fine in vs2003) anyone got a clue on how to fix this?
thanks Gil
|
|
|
|
|
Is it possible for a single client to have multiple connectiosn
with a single host?
if so how?
|
|
|
|
|
Are you talking about Database connections?
|
|
|
|
|
Dear i m asking about socket based client server
architecture.
|
|
|
|
|
When pdb file is generated ? Why it is generated while building a solution in Debug Mode ? Why is it not generated in Release Mode ? What is the difference between Debug Mode Build and Release Mode Build?
|
|
|
|
|
A PDB file - or Programming Database - contains symbols (method names, field names, class names, etc.) for your assemblies. They are useful for debugging - more so with native code where type metadata doesn't exist (meaning that there's no reflection functionality that can get class, method, field, and property names like in .NET). A full PDB file contains source information so that in debug builds you can get line numbers in exception stack traces.
By default, PDB files aren't generated for release (retail) builds but you can generate stripped PDB files (stripped means that source information is not included, which is what you typically would send out to customers). In Visual Studio in the Project properties, look for "Generate Debugging Information" in the build catagory.
Even Microsoft makes available stripped public symbols for free, which can be downloaded as a whole or downloaded when needed using a symbol server (preferred so you don't have to keep updating your local symbol store automatically after installing patches or service packs). See my blog entries at http://blogs.msdn.com/heaths/search.aspx?q=symbols&p=1[^] for details.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi there,
I have a problem with the Active Directory part of the .Net framework.
In our AD setup we are allowed to read a set of variables for a user with an anonymous login. If you have a username and a password you can get a lot more information about the specific user.
This piece of code works fine for the anonymous access:
DirectoryEntry de = new DirectoryEntry(@"LDAP://servername/ou=People,o=company");<br />
DirectorySearcher ds = new DirectorySearcher(de);<br />
ds.Filter = @"(uid=username)";<br />
ds.SearchScope = SearchScope.Subtree;<br />
SearchResultCollection results = ds.FindAll();
I get the limited set of informations about the user. If I try with my logininformation
DirectoryEntry de = new DirectoryEntry(<br />
@"LDAP://servername/ou=People,o=company",<br />
@"cn=username,ou=SystemUsers,ou=Accounts,o=company",<br />
@"password",<br />
AuthenticationTypes.Secure);<br />
DirectorySearcher ds = new DirectorySearcher(de);<br />
ds.Filter = @"(uid=username)";<br />
ds.SearchScope = SearchScope.Subtree;<br />
SearchResultCollection results = ds.FindAll();
Then I just get a "Logon faliure: unknown user name or bad password".
One would then say that I have entered the wrong login information. But... When I use the exact same login information in the LDAP browser from Softerra (http://www.ldapadministrator.com/download/index.php) it works fine, and I get my extended details.
I'm
I have tried with several combinations in the AuthenticationTypes field, and I have googled the problem without success... Anyone have any ideas ?
Lasse Fabricius
|
|
|
|
|
Hi,
This a a request for some seriously urgent help please...
I have an application that needs to print a crystal report directly to a printer attached to a PC. The Print needs to be direct ie: the user is not presented with a preview or a print dialog box. The pc is standalone and not connected to any network.
Printing a crystal report directly to a printer is easy if the pc is networked because you can set the PrintOptions.PrinterName to the name of the printer as identified on the network. I need to know how to do the equivalent of this but by specifying the LPT port number. Does anyone know how to do this.
Here is my function where i set the print options
private void SetPrintOptions()<br />
{<br />
CrystalDecisions.CrystalReports.Engine.PrintOptions printOptions = crDocument.PrintOption; <br />
printOptions.PrinterName = CURRENT_PRINTER;<br />
printOptions.PaperOrientation = PaperOrientation.DefaultPaperOrientation;<br />
printOptions.PaperSize = PaperSize.PaperA4;<br />
printOptions.PrinterDuplex = PrinterDuplex.Default;<br />
printOptions.PaperSource = PaperSource.Auto;<br />
}
Any help will be greatly appreciated.
Craigo
** Vision - The ability to look further than your eyes can see
|
|
|
|
|
Have you considered just setting PrintOptions.PrinterName to an empty string (string.Empty , or just "") to use the default printer? In lieu of presenting the user with printer options this would provide a consistent user experience - print to the printer they selected as the default.
Based on the documentation it doesn't seem like you can refer to an LPT port.
If you want to find out the printer name on a specific LPT port, you could P/Invoke EnumPrinters http://msdn.microsoft.com/library/en-us/gdi/prntspol_9fjn.asp[^] and enumerate the printers till you find one installed on LPTx: (keeping in mind that a printer can be on more than one LPT port, so in that case a comma-delimited list is returned so be sure to parse that as well).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thanx for the quick reply Heath.
I can't use an empty string for the printer name because (and i should have mentioned this in my origional post) there are 2 printers connected to the PC and i have to print a separate report to each of them. The one printer has pre-printed stationary and the other is plain paper - so I have to implicitly send the report to the correct printer.
I will look at the EnumPrinters solution you have suggested. This may sound like a really stupid question but do all printers that are connected to a PC have a name, even if it is not on a network?
Thanx again for your help.
Cheers
Craigo
|
|
|
|
|
FWIW - though it may not be relevant to your problem - multi-tray printers will (or, at least, should) select the right tray based on the media in the tray.
Craig G Fraser wrote: This may sound like a really stupid question but do all printers that are connected to a PC have a name, even if it is not on a network?
Yes they do. Open your "Printers and Faxes" folder (or the equivalent on whatever OS you're running) and you'll see all the various names. These are the names of the printers as should be specified in PrintOptions.PrinterName . If the printers on the various machines (or just a single machine) are all the same and you require such a constraint, you could fix the printer names or, better yet, make them configurable in the application configuration file (yourexe.exe.config in the same folder as yourexe.exe). This way if a machine for some reason must use a different name you can configure it per-application/per-machine.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Excellent..that sounds like the answer. In my app i had the LPT ports configurable in my app.config so i'll just change this to hold the printer name instead as you have suggested.
Heath Stewart wrote: If you want to find out the printer name on a specific LPT port, you could P/Invoke EnumPrinters http://msdn.microsoft.com/library/en-us/gdi/prntspol_9fjn.asp[^] and enumerate the printers till you find one installed on LPTx: (keeping in mind that a printer can be on more than one LPT port, so in that case a comma-delimited list is returned so be sure to parse that as well).
Any chane you point me to some sample code that retrieves the printer names as mentioned above...I had a look at the link you sent but i'm afraid having not worked in this area a lot, it doesnt really make too much sense to me.
Craigo
|
|
|
|
|
PInvoke.net[^] is an excellent resources for finding P/Invoke signatures. I myself add some new signatures from time to time.
Specifically, you can find this one at http://pinvoke.net/default.aspx/winspool/EnumPrinters.html[^]. I haven't tested it but there is a sample so hopefully this will get you started.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Customer Product-lifecycle Experience
Microsoft
[My Articles] [My Blog]
|
|
|
|