|
If you're talking about the pre-processing line or a DOCTYPE, that would work. However, if you're talking about removing the root element, you should read-in the document as an XmlDocument , get the child node(s) of the DocumentElemnt , and write those out to a file.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
How do I make my own exception class?
This is as far as I got:
class WhatEverException : System.ApplicationException<br />
{<br />
}
Now...
How do I set the exception message from my class? I didn't notice any members that would allow it... am I just missing soemthing?
|
|
|
|
|
|
|
Hi,
I have a problem with streaming XML. I have created an aspx which return me an xml file format (Type text/xml, Encoding.UTF8). Also now, I try to read this stream in the XmlTextReader but I receive an Error Message when I parse it. And of course, I don't understand that.
Could you help me?
It is a bit urgent....
Thanks a lot
Code Source
XmlTextReader XR = new XmlTextReader(Server.MapPath("GenerateXmlTreeView.aspx"));
while(!XR.EOF){
XR.ReadElementString(); //Here Thrown exception
}
Sr.Close();
When I run may aspx
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: The '%' character, hexadecimal value 0x25, cannot begin a name. Line 1, position 2.
Source Error:
Source XML:
<?xml version="1.0" encoding="utf-8"?>
<treeview title="Licenses Tool">
<custom-parameters>
<param name="shift-width" value="15" />
<param name="img-directory" value="images/" />
</custom-parameters>
<folder title="1999" url="49">
<folder title="Gis Eastern" url="39">
<leaf title="Azerbaijan" url="37" reg="N" />
<leaf title="Belarus" url="20" reg="N" />
<leaf title="Bulgaria" url="21" reg="N" />
<leaf title="Croatia" url="22" reg="N" />
<leaf title="Czech Republic" url="23" reg="N" />
<leaf title="Estonia" url="24" reg="N" />
<leaf title="Hungary" url="25" reg="N" />
<leaf title="Kazakhstan" url="26" reg="N" />
<leaf title="Latvia/Lettonia" url="27" reg="N" />
<leaf title="Lithuania" url="28" reg="N" />
<leaf title="Poland" url="29" reg="N" />
<leaf title="Rumania" url="30" reg="N" />
<leaf title="Russia" url="31" reg="N" />
<leaf title="Slovakia" url="32" reg="N" />
<leaf title="Slovenia" url="33" reg="N" />
<leaf title="Turkey 1" url="38" reg="N" />
<leaf tit
-=zoltx=-
|
|
|
|
|
zoltix wrote:
Server.MapPath("GenerateXmlTreeView.aspx")
This just returns the path to the "GenerateXmlTreeView.aspx" file on the server. It doesn't execute the code contained in that file or do anything but take the virtual filename and give you the physical path to it.
You will probably be better served if you ask this in the ASP.NET forum to find out how to get the output of that page into another page.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
|
Does anyone have or know of a strategy for Data Authorization?
I have a requirement to limit a list of records returned from the database depending on user-defined filters. E.g. a grid with employees is limited by the supervisor who is logged on.
These filters can go to other tables etc.
I was thinking about passing my DataSet to a class and let that class filter it for me but i wasnt sure to put it in the BLL or in the DAL.
Thanks in advance for any help
--Adam Turner
|
|
|
|
|
It depends if you are ever going to use those records. If not, why bring them over the wire (assuming this goes over or could go over a wire) or consume memory. If it does not interact with, nor effect, the business logic and the user cannot modify the filter (only set when the user logs in or starts the program), I personally think it would seem best to handle it lower in the tiers such as DAL.
Rocky Moore <><
|
|
|
|
|
Hi all
I am about to choose a platform for a application i am willing to write. The problem is, that it will be deployed on rather not new machines (hopefully >win95, which .net framework doesnt support). Another problem is that i dont want to go to the client every time he doesnt properly install my application - here i mean .net framework errors when installing or other problems (eg. not meeting .net framework reqs : not installing IE 5.01 before, not installing win2k sp2, etc ...).
My app would be Windows Forms / Ado.NET / Ms Sql Srv Interop
And here is my question : would You recommend me choosing .NET framework as a base platform for my application, or to choose Borland with its VCL and Database components ?
please everyone - answer, write your own experiences, and so
thank You very much in advance
|
|
|
|
|
There is never a time I would choose Borland (too many bad memories there). Nevertheless, I do not see why you are so limited. Of course, it would depend on which language(s) you have under you belt, which language would best fit the situation and what you expect from the program. There are other options such as C++/MFC or VB with MSDE or MS Access files. You could also use FoxPro or MS Access.
You, as the programmer, are also able to take care of any installation issues since your install program should check for these conditions.
I did notice the "hopefully" on the limit of greater than Win 95. If there is any chance you will support Win 95 then .NET is out!
Of course, with .NET you will gain flexibility, expandability and scalability along with maintainability. Therefore, I guess it depends on what the “ability” your client wants
Rocky Moore <><
|
|
|
|
|
Thanks for answer
About limitations - clients want application to run on Ms Sql Srv - actually i am porting it from access based solution to Ms Sql based;
language - C++/MFC i the language i am best at, but it would take much longer time to build applications (over 40 forms, and when using MFC its too long for me). VB - old one - i am afraid, the at one moment it will have limitations that i am not able to cope with ( i preffer solid ground languages, not interpreted ones) - VB.NET - is good, but i am feeling much better at C#
ehh, nevermind, nevertheless, thanks for answer
|
|
|
|
|
Konrad Rotuski wrote:
(over 40 forms,
That sounds like a sizable app. Personally, I use C# and make the minimum requirement Win98. That way you have a scalable application for the future that is fairly easy to maintain (depending of course on how you create it). Depending on your forms, VS.NET C# does have a Data Form wizard that might be able to help with some of the work.
Rocky Moore <><
|
|
|
|
|
In vb.net, if I define a function as such:
Public Sub Foo(a as string)
...
End Sub
I could call it like this, if I am not bothered of the parameter I pass in:
Foo(New String())
Is there anyequivalent technique in C#?
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
|
:slaps head: duh!
But what if the parameters are objects?
Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning
Mark Twain
Get your facts first, and then you can distort them as much as you please
Mark Twain
|
|
|
|
|
Well, if you want to pass an invalid object(I belive it's what Nothing is in VB), Foo(null);
If you want to pass a valid object, but don't care what it is like, Foo(new Whatever());, just like in VB (Assuming it has a 0-param constructor. If it doesn't, you'll have to fill in some parameters or just use null)
|
|
|
|
|
Notorious SMC wrote:
I could call it like this, if I am not bothered of the parameter I pass in:
Foo(New String())
Is there anyequivalent technique in C#?
You can also Overload the member such as:
public void Foo(string a)<br />
{<br />
}<br />
<br />
public void Foo()<br />
{<br />
Foo("");<br />
}
This can keep control in your class and show outside your class that is it safe to pass no parameters.
Rocky Moore <><
|
|
|
|
|
I would like my app to be notified of Click events from anywhere on the screen. I have tried a TransparencyKey=back ground colour form but the Clicks go straight through. I tried a 0% opaque window, but the hardware does not support it. Any ideas how I can do this in C# without resorting to Interopping with a bit of C code or polling Control.MouseButtons?
Update - I had tried using Opacity=2 for 2 percent, whereas I should have used 0.02! However, the challenge still stands because a completely not-opaque window lets all the mouse event through.
|
|
|
|
|
Not sure in C# but with the WINAPI you call SetWindowsHookEx with WH_MOUSE. You may be able to interop that with C#. Don't know if its been done or if its possible. But that information should get you started on Google.
|
|
|
|
|
Hi All!!
a Class Library project contains
namespace MyCustomMethods{<br />
public class Vlidations{<br />
}<br />
}
a Cusotm Control Library uses some methods from the above project
namespace MyCustomControls{<br />
public class SSTextBox : TextBox{<br />
}<br />
}
problem is that when i create control at run time, it works fine but when i drag it on form from toolbox it just shows wait cursor and nothing happens
sorry for my bad English.
|
|
|
|
|
Hi There !
I am trying to build a server - client application, using tcp/ip and sockets.
I would like that the server will be able to listen to some clients, and if a new client "shows up", the server notice the new client and will add it to other clients.
Can someone show me an example for something like this ?
Thanks.
|
|
|
|
|
Your server socket must use the Accept method to handle incoming client requests. Actually you should use BeginAccept uses the thread pool) for server apps for performance.
In accepting these requests a handler handles the request and it is in this handler that you can add all incoming requests to wherever you want.
|
|
|
|
|
My server socket already uses Accept method.
The thing is that I eant to avoid this situation:
IPEndPoint a_EndPoint = new IPEndPoint(ipAddress, a_port);
IPEndPoint b_EndPoint = new IPEndPoint(ipAddress, b_port);
...
// Create a TCP/IP socket.
Socket a_listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
Socket b_listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );
// Bind the socket to the local endpoint and listen for incoming connections.
try
{
a_listener.Bind(a_EndPoint);
a_listener.Listen(num_of_clients);
// The maximum length of the queue of pending connections
b_listener.Bind(b_EndPoint);
b_listener.Listen(num_of_clients);
// The maximum length of the queue of pending connections
...
while (true)
{
// Set the event to nonsignaled state.
all_done.Reset();
// Start an asynchronous socket to listen for connections.
Console.WriteLine("Waiting for a connection...");
a_listener.BeginAccept( new AsyncCallback(accept_callback_a), a_listener );
b_listener.BeginAccept( new AsyncCallback(accept_callback_b), b_listener );
...
// Wait until a connection is made before continuing.
all_done.WaitOne();
You see, I have to create a new object for socket, and to create each one its own function and its own delegat...
How can I avoid this ?
Thanks.
|
|
|
|
|
I'm noy quite sure what you mean exactly? Are you saying that an accept is required for every client? If so, and if I'm understanding exactly your situation, this is not correct.
You only need one server socket and it will be "accepting" ALL client requests. Again, all clients will be making a request to the one server listening socket. Now when the server "accepts" the a request you can process that one request as you see fit while at the same time the server may be "accepting" other requests.
All these things happen concurrently. That is why we call the server an asynchronous socket.
|
|
|
|