XML XPath and Simple Stringwriter or Streamwriter Question in Datagrid

ASP.NET

    Next

  • 1. How to set the RegularExpression
    I want to limit the iput of Textbox: 1.The input character must within '0'-'9' or 'a'-'d', for instance a091b, d23c, 123, ad.. is ok, but f9a, ddu.. is not ok 2. null value is ok I set RegularExpressionValidator to a textbox, but how can I set the RegularExpressionValidator.ValidationExpression?
  • 2. Using HttpWebRequest to post form data with cookies
    I'm working on a web scraping application that needs to log into a website before it can get the data to scrape. I've always been confused about how the HttpWebRequest and HttpWebResponse objects work together with cookies, and was hoping that someone here could clear it up for me! Here's the steps I need to accomplish: 1) Set two cookies containing information I already have 2) Request the login page URL, and save a third cookie that is given to me from that page 3) Submit a form via POST, along with the 3 cookies 4) Save a fourth cookie that is set after the form is submitted with valid information I don't need the entire code to do this, but rather some help with the order to do it. Do I create a request and THEN set the cookies? Can I use the same CookieContainer for each request? If someone could point me in the right direction it would be greatly appreciated!

XML XPath and Simple Stringwriter or Streamwriter Question in Datagrid

Postby needin4mation » Sun, 19 Jun 2005 03:10:15 GMT

Hi, please consider this snippet:

string filename "c:\\inetpub\\wwwroot\\getdirections\\Directions.xml";
XmlDocument doc = new XmlDocument();
doc.Load(filename);
XmlNodeList authorList =
doc.SelectNodes("/NewDataSet/location[locationidID='westside']");
StreamWriter writer = new StreamWriter();
foreach( XmlNode authorNode in authorList )
	{
	writer.Write( authorNode.OuterXml );
	//Response.Write(authorNode.OuterXml);

}

DataSet ds = new DataSet();
ds.ReadXml( writer.ToString() );
CustomerDataGrid.DataSource = ds.Tables["locations"];
CustomerDataGrid.DataBind();

If I use Reponse.Write, this work (not using the datagrid of course).
What I am trying to do is capture that data in the foreach into some
kind of stream or *something* so I can bind it to my dataset.  The
query works, the data will return.  I just cannot find out how to
assign it to the dataset from a stream.

Thank you for any help.


Re: XML XPath and Simple Stringwriter or Streamwriter Question in Datagrid

Postby intrader » Sun, 19 Jun 2005 07:03:05 GMT



Something like
DataSet ds = new DataSet;
ds.ReadXml(rawXMLReader);

Then you can bind


Similar Threads:

1.StreamWriter, StringWriter and encoding...

Hello,

i have a big problem with my email component, because each time i write the 
generated message directly to the spooler, the streamwriter will write in 
Unicode.

The file starts with a FF FE and is double byte.

This is a problem because when a mail server like QMAIL receive the message, 
will reject for malformed LF.

Infact, the file is Unicode and the normal CR/LF is (0D 00 0A 00) and QMAIL 
reading 00 0A fails.

I tried everithing...

The code:

StringWriter SW = new StringWriter(new StringBuilder());
SW.WriteLine("x-sender: <" + this._From.Address + ">");
[...]
string message = SW.ToString();
using (StreamWriter sw = new StreamWriter(filename,true,Encoding.ASCII))
{
sw.Write(message);
}

Please help,
Regards
Stefano

2.Simple xpath question



Return to ASP.NET

 

Who is online

Users browsing this forum: No registered users and 76 guest