|
hi, this is a nested HTML table. Using Xpath .//table//tr we can retrieve all table rows. That's what double forward slashes does for you (matches not only level one beaneath current node but also any sub level deeper in the hierarchy).
What I want to achieve is to be able to retrieve first-level table rows only but WITHOUT hardcoding path using single forward slash:
.//table/tr
As we can, possibly, have <tbody> tag sitting beneath <table> tag but about <tr>, in which case above xpath will miss!
(But using double forward slashes on tr will capture second level tr's which I want to exclude)
Many thanks
<html>
<head>Sample page</head>
<body>
<table>
<tr>
<td>
<table>
<tr>
<td>Name</td>
<td>John Doe</td>
<tr>
<tr>
<td>Tel</td>
<td>416-987-1234</td>
<tr>
</table>
</td>
<td>
<table>
<tr>
<td>EmpID</td>
<td>12345</td>
<tr>
<tr>
<td>Salary</td>
<td>75000</td>
<tr>
</table>
</td>
</tr>
</table>
</body>
</html>
dev
-- modified 26-May-12 22:44pm.
|
|
|
|
|
Sorry about the delay, I was off-planet for the last week.
How about "//tr[not(ancestor::tr)]" -- any tr with no ancestor tr ?
And we have an XML/XSL forum.
|
|
|
|
|
hi,
I have a wpf canvas. Into this canvas, dynamically add 2 more canvases, when the user pushes a button.
When I try to get the margin of these 2 cavnases, or the Top or the left Property, I always get zero.
thanks for any help
|
|
|
|
|
Canvas layout elements aren't assigned any location by default. You have to supply these yourself.
|
|
|
|
|
Hi, Pete
when I add the canvases to the main canvas, I am setting their top or left property through Canvas.SetTop(), Canvas.SetLeft().
I think that this way the new elements are assigned position.
At least the Top or Left Property should have values. But they are zero also.
|
|
|
|
|
|
Hi amitgajjar,
1)This is my user control that has a canvas in it. This is the user control I add into the parent canvas.
<UserControl x:Class="Aluminium.usercontrols.ShutterUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:Aluminium.viewmodels"
xmlns:cnv="clr-namespace:Aluminium.converters"
xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300" >
<UserControl.Resources>
<!--<cnv:DataSideToThicknessConverter x:Key="sideToThick" />-->
</UserControl.Resources>
<Canvas Name="VisualCanvas" Background="AliceBlue" VerticalAlignment="Stretch" Width="{Binding Path=OpticalWidth}" Height="{Binding Path=OpticalHeight}" >
<Border BorderThickness="{Binding Path=BorderThickness}" Name="CanvasBorder" BorderBrush="Black" Width="{Binding ElementName=VisualCanvas, Path=Width}" Height="{Binding ElementName=VisualCanvas, Path=Height}">
<Canvas Name="ShutterCanvas" Width="Auto" Height="Auto" HorizontalAlignment="Center" VerticalAlignment="Center" >
<StackPanel>
<Label Name="ShutterLabel" Content="{Binding Path=ShutterLabel}" />
<Label Name="ShutterHeightValue" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding Path=Height}" />
<Label Name="ShutterWidthValue" VerticalAlignment="Center" HorizontalAlignment="Center" Content="{Binding Path=Width}"/>
</StackPanel>
</Canvas>
</Border>
</Canvas>
</UserControl>
2) This is how I add this user control to the parent Canvas. VisualCanvas is the parent canvas. FocusedCanvas is a data object. Offset is the length in pixels from the top of the parent canvas, where I insert the child canvas. The counter (i) takes the value 1 or 2 because each time I add 2 canvases together.
this._helper.FocusedCanvas.VisualCanvas.Children.Add(sui);
Canvas.SetTop(this._helper.FocusedCanvas.VisualCanvas.Children[i], offset);
After that if I try to read the margins and top values for the user control itself I get :
a)((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i])).Margin = {0,0,0,0}
b)Canvas.GetTop(((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i]))) = 0.0
and if I try to read the margins and the top values of the included canvas I get :
a)((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i])).VisualCanvas.Margin = {0,0,0,0}
b)Canvas.GetTop(((ShutterUI)(this._helper.FocusedCanvas.VisualCanvas.Children[i])).VisualCanvas) = NaN
any help is appreciated
|
|
|
|
|
If you assign the Canvas locations, it doesn't have any effect on the position of the child elements because they are added at the default position of the Canvas they are added into. You need to explicitly set the position of the elements on the Canvas before you can get a position value.
|
|
|
|
|
i need help in creating a banking account register. I have to do this through Visual Basics. The register will include Account Name, Account Number, and Account Balance, and it will allow a user to enter deposit or withdrawal
information. Throughout the chapters, you were given all of the tools necessary to complete this task.
Use a flowchart to help with your decisions and the programming example in Chapter 9 to help with the
project. Good luck!
Rules
1. The initial graphical user interface should contain a label that contains your name and MEID#,
and it should provide two user interaction options: Enter Account Information and Clear.
2. When the user selects Enter Account Information, the graphical user interface should provide
three options: Account Name, Account Number, and Beginning Balance.
3. After the user enters the correct information, allow him/her to continue by using the Continue
Option.
4. The selection of Continue should provide the user with Withdrawal Amount and Deposit
Amount.
5. The Continue button selection should also make the label Beginning Balance read Available
Balance, and the text boxes in Account Information should become read‐only.
6. Allow users to enter Withdrawal Amount and Deposit Amount and change Account Balance
accordingly.
7. Clear Withdrawal and Deposit amounts/text boxes so users can continue to enter additional
amounts.
8. The user should be able to add as many withdrawals and deposits as he/she wants.
9. The Clear button should clear the program and return to Step 1 whenever it is selected.
|
|
|
|
|
Things you should avoid doing (all of which you have done):
- Ask us to do your homework.
- Make subject lines that give no indication of the contents of the message.
- Beg for help.
- Post the same message across multiple forums.
If you have a specific question, and you can ask it in a considerate manner, we'd be happy to help.
|
|
|
|
|
i will bookmark your reply. as so many ppl do the same mistake when posting their problems.
|
|
|
|
|
Member 9030645 wrote: Throughout the chapters, you were given all of the tools necessary to complete this task.
It says right there that you should be able to complete this on your own.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Member 9030645 wrote: i need help...
1. Read chapter 9. Review previous chapters as needed.
2. Write some code
3. Test it
4. Repeat steps 2/3 until you have completed the assignment.
Good luck!
|
|
|
|
|
Hi everybody
How can i send a mail in C#
|
|
|
|
|
|
Hi,
if you would like to send email using your gmail account with attachment using c# code, then please refer this link
-Amit
|
|
|
|
|
I have a class that gets it's startup path using the following:
String myPath = Application.StartupPath;
This worked fine with it's own test form, but once I was referring to this class from another class in a different directory, it returns the wrong directory. Is there a c# way to get the directory of the class and not the class that calls it?
Thanks for any help!
|
|
|
|
|
Console.Write(typeof(string).Assembly.Location);
Will the path, prolly including the assemblies name.
Bastard Programmer from Hell
|
|
|
|
|
Uh, surely that will tell you where mscorlib is?
|
|
|
|
|
Yes. Do you think I should have said that I used "string" as an example type?
Bastard Programmer from Hell
|
|
|
|
|
This has nothing to do with classes, it returns the path to the executable program as described here[^].
|
|
|
|
|
Assembly.GetExecutingAssembly().Location.
|
|
|
|
|
Surely, that returns the location of the executing assembly?
TopicStarter wrote: Is there a c# way to get the directory of the class and not the class that calls it?"
Bastard Programmer from Hell
|
|
|
|
|
Yes, but 'the class' surely refers to the current class, which will be in the executing assembly. That's how I read it, anyway.
|
|
|
|
|
Yup, sounds logical too. It must be either time for coffee, or for some sleep
Bastard Programmer from Hell
|
|
|
|