|
Christian Graus wrote: Who writes HTML now and DOESN'T write XHTML ?
The ones who write HTML. The ones who write XHTML writes XHTML, not HTML.
---
b { font-weight: normal; }
|
|
|
|
|
XHTML IS HTML, although not all HTML is XHTML, obviously.
|
|
|
|
|
Thanks for your answer, I don't totally agree with it, but I have to admit that its is close to correct.
Comming from the java world (I just pick up .Net this month) and having worked with Mozilla Firefox, I have navigated HTML (most accuratly DOM) using XPath before. In fact the DOM level 3 API does specifies an XPATH API which has been implemented in the mozilla browser and allows for XPATH navigation of HTML (last time I tried it about 6month ago it was very slow, but did work).
Since I need to be able to do some work with the HTML node that I would select via XPATH, (i.e In addtion to parse the text, I might need to change their HTML properties and have these result show in the HTML document) the options of creating a duplicate well-formed HTML or XHTML will not work for me.
After some reading and research, I decided to implement my own HTML XPATH navigator for HTML by extending the XPathNavigator class. Technically, my XPATH navigator navigates the DOM tree created by MSHTML and not the true HTML text source, but this will work fine for my purpose and to me is not differnt then manipulating the DOM via javascript. I am nearly done with my implementation, and hope to be finish testing in a few days, when I'm done, I'll put my code on the site.
Since I am navigating the DOM with my XPATH navigator instead of the source, there are a few notable differences:
1) All HTML Tag names have to be specified in upper case regardless of what case they were in the source document.
2) attribute node contain all the attributes specified in the schema (or at least most of them) so using the navigator navigation function like moveToFirstAttribute() probably will not position the the navigator curson on the first attribute specified in the source, but will position it on the first attribute according set of the union of those specified in the source and those specified in the schema. This is also fine for my purpose.
|
|
|
|
|
Hello Code Project Team.
Someone know how get the row index from excel spreadsheet?
Example:
[Profile.xls - spreadsheet1$]
<br />
| FirstName | LastName | Age |<br />
---|-----------|-------------|-----|<br />
1 | Anthony | Acuña | 22 |<br />
2 | Michael | Danagan | 24 |<br />
3 | Benjamin | Beat | 24 |<br />
4 | Monica | Danagan | 23 |<br />
C# Code
<br />
OleDbConnection conn = new OleDbConnection();<br />
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Profile.xls;Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;MaxScanRows=0;\"";<br />
conn.Open();<br />
<br />
DataTable dt = new DataTable();<br />
<br />
string SQL = "SELECT * FROM [spreadsheet1$] WHERE FirstName LIKE 'M%'";<br />
OleDbDataAdapter da = new OleDbDataAdapter(SQL, conn);<br />
da.Fill(dt);<br />
<br />
this.dataGridView1.SuspendLayout();<br />
this.dataGridView1.DataSource = dt;<br />
this.dataGridView1.ResumeLayout();<br />
This work correctly and only show:
| FirstName | LastName | Age |<br />
|-----------|-------------|-----|<br />
| Michael | Danagan | 24 |<br />
| Monica | Danagan | 23 |<br />
But I need retrieve what is the row index on excel file for every row.
I need show the info in DataGridView in the follow format:
<br />
| ExcelIndex | FirstName | LastName | Age |<br />
|------------|-----------|-------------|-----|<br />
| 2 | Michael | Danagan | 24 |<br />
| 4 | Monica | Danagan | 23 |<br />
I hope that you can help me.
Thanks in advanced.
-- modified at 22:55 Sunday 12th November, 2006
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
Im gonna guess that you cant just add a row to the excel sheet, and write the numbers in yourself?
Hmm, perhaps, creating a temporary array to store all the data from the excel sheet, then you can use the index from that, but of course, if its a big document it would consume alot of memory.
|
|
|
|
|
Hi, first post on this site.
I've just started C# really and have been using some of these tutorials and microsoft's video series. But, I got bored of the video series and started just playing around.
I decided, I wanted to create a web browser, so I added the web browser object to my form and a textbox and button to type in the address and initiate the search respectively.
Then I decided I wanted to add a bookmark feature, so I added a menuStrip and a Bookmark tab to it. I made it create a new instance of Bookmark.cs which I had created. On the Bookmark.cs form I added a listbox and button.
The listbox displayed the data from a database that I had added to the project, I entered some example data and this all worked. But, when I click the button on the Bookmark.cs form, I want it to set the webBrowser1.Navigate() function to the SelectedValue of the listbox on Bookmark.cs. Yet, I cant because webBrowser1 isn't public.
What I am really asking is, how do I make webBrowser1 public, so that I can access it from Bookmark.cs?
Thanks,
Any reply is appreciated.
|
|
|
|
|
The problem is not that it's not public, it's that it's not static, so you need a copy of the form that contains the active control, for you to be able to access it. This is the wrong way to do it anyhow, you don't want to make the control public, you want to either expose a method that calls the Navigate function, or, better yet, set up a delegate so that your bookmark form can call into your main form and do this for you.
|
|
|
|
|
As I said, I'm a beginner at C# so could you please go into more detail on that because I don't know what you are talking about, except the static bit. What is the right way to do it?
Any reply appreciated.
|
|
|
|
|
The way i usually do global variables is with a class, like this:
internal class Globalvars
{
internal static int variable;
Globalvars(){}
}
You just mark all the variables as internal static, and you call them like this:
Globalvars.variable
Just store variables there and access them from somewhere alse later on.
You should be able to access them from anywhere.
I don't know if this helps but.. there you go.
|
|
|
|
|
Well, the first step is to not create global variables if you can help it.
www.codeproject.com/csharp/passdatadelegate.asp would be one example of how to use delegates. Have the bookmark page define a delegate which is hooked up to a method on the main form, and passes through the URL to browse to.
|
|
|
|
|
Hi
I have a suggestion to make.How about writing a method in you web browser from that gets a bookmark and ask the web browser to nvaigate to it.
for example:
<br />
public void NavigateToBookmark(Bookmark bm)<br />
{<br />
this.webBrowser1.Navigate(bm.Url);<br />
}<br />
Anyway,I don't think that declaring the web browser control as public is a good idea,because if you do so,you make your bookmark dependent to a specific webbrowser and that's not good if you want to use the bookmark in some other code.Instead you can make your bookmark holds a reference to a webborwser(not to use a specific webbrowser) or you can pass a webbrowser object to your bookmark
<br />
public class BookMark<br />
{<br />
WebBrowser browser;<br />
public BookMark(WebBrowser browser)<br />
{<br />
this.browser=browser;<br />
}<br />
public void Navigate()<br />
{<br />
this.browser.Navigate(this.url);<br />
}<br />
}<br />
Or
<br />
public void Navigate(WebBrowser browser)<br />
{<br />
browser.Navigate(this.url);<br />
}<br />
Regards
|
|
|
|
|
Thanks, I think I will try this, also thanks for the help christian but that link doesn't work.
Thanks all.
|
|
|
|
|
Ok, I don't know what to do now. I am creating a TextEditor (because I saw it in another post ).
Anyway, I have created the main form, but when the program starts it displays another form called newDlg.cs It has buttons on, with labels saying "Create a Text File:" or "Create a CSV File:" etc.
When the button is clicked, it opens the main form and assigns a variable called fileFormat to 1 or 2 (for Text File and CSV respectively). The fileFormat variable is then used to determine whether the file can be saved as a .txt or a .csv when the user clicks Save.
I need to somehow make fileFormat global because it is used in newDlg.cs and Main.cs
I tried the method of creating a globalVars.cs class but that didn't work.
Anyone got any idea?
Thanks.
|
|
|
|
|
Hello,
I am very new to the usage of C#, The task for me to perform is to convert a "string" to a list of objects. I would receive a string message, read the message and split it accordingly into list of file objects as shown below.
XXX OK|<error string=""> CRLF
[IPv4Addr:< IPv4 dotted IP address> CRLF
Port:<port number=""> CRLF
Uplink BW: <bandwidth in="" kbps=""> CRLF
File: <file name=""> CRLF]*
EOM: CRLF
It would be great, if anyone could help me on this.
Thanks,
Kishore
|
|
|
|
|
You can use the split method to turn it into an array of strongs ( using a space as a delimiter, from the look of it ). What you do to parse the strings after that depends on what you need.
|
|
|
|
|
Hi Kristamed, you can use the Regular Expressions, these have more powerful.
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
The following code creates a string object with substrings separated with '|' character. In order to get an array of strings you could use string.Split method:
<br />
string str = "test1|test2|test3";<br />
string[] list = str.Split('|');<br />
|
|
|
|
|
hi
i want to invisible first row of my DataGridView,But The following error shown me :
Row associated with the currency manager's position cannot be made invisible.
my code is :
this.categoryTableAdapter.Fill(this.dataSet_AddressBook.Category);
categoryDataGridView.DataSource = this.categoryBindingSource;
categoryDataGridView.Rows[0].Visible = false; // Error Occured in this line
How to solve my problem and set categoryDataGridView.Rows[0].Visible to false ?
thanks
|
|
|
|
|
If you don't want to see it, why don't you remove it ?
|
|
|
|
|
hi
i want to use this row in other forms,but in the one form i want to set it's Visible to Flase.
|
|
|
|
|
OK, so make a copy of your data source, remove the row, and set that as the data source in this instance. Or handle the event that's fired when a row is rendered, and stop it from rendering the first row.
|
|
|
|
|
hi
can u explain more ?? if u can please give me an example .. thanks ..
|
|
|
|
|
If you use the Clone method to copy the data source, you can remove the top row from the copy.
|
|
|
|
|
Hi hdv212.
You can use the row filter property from DataView.
Example:
DataTable dt = new DataTable();<br />
this.categoryTableAdapter.Fill(dt);<br />
dt.DefaultView.RowFilter = "category_id <> 1";
categoryDataGridView.DataSource = dt
SINCERELY.
ANTHONY ACUÑA
PREFERED PHRASE:
SOMEBODY TELL ME WHY IS MORE REAL WHEN I DREAM THAT I AM WAKE?
|
|
|
|
|
I currently have a dual monitor setup on my system, one a monitor, and one a TV. the problem is, my TV is not always on, or someone is using it, therefore I am left with only one Monitor on a dual monitor setup. I could activate and deactive my setup, but that is bothersome. What I wanted to do is create a program that will allow me to move existing windows to specific locations. For example, if a window is stuck on my TV monitor, I can input the coordinates of my computer monitor, and the window will be moved. I have been trying to target the processes, but I don't seem to be able to set the location of the window. Does anyone have any ideas?
|
|
|
|