|
Hi All,
I am trying to read a XML file which contains "=" as value of one of the attribute. The compiler throws following error when i am loading this XML using XMLDocument.Load().
'=' is an unexpected token. The expected token is ';'.
Following is the position where i get the error :
<tab name="Blogs" key="http://www.ournhs.nhs.uk/?cat=3&feed=rss2" />
key attribute contains "=" which throws the error.
Can anyone pls guide me in reading this xml.
Cheers
Mani.
First have the WILL then u WILL
modified on Monday, May 19, 2008 7:50 AM
|
|
|
|
|
Its the ampersand thats the problem. & must be encoded as & when writing the document. If the document has been created with an actual & on its own then its not valid Xml.
modified on Monday, May 19, 2008 8:57 AM
|
|
|
|
|
Jamie has the right answer but didn't double up the escaping! & must be encoded as & when placing a URL with query parameters in an XML file (or anywhere else an & character appears).
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi,
I tried to display an image in an image control in VS 2005, every other thing works except the displaying of the image. However, it works with VS 2003. Here's my code:
protected void uploadButton_Click(object sender, EventArgs e)
{
string fileName = FileUpload1.PostedFile.FileName;
fileName = Path.GetFileName(fileName);
string fileFolder = Server.MapPath("~/images/");
string filePath;
bool fileOk = false;
if (FileUpload1.PostedFile.ContentLength > 0)
{
string fileExtension = Path.GetExtension(FileUpload1.PostedFile.FileName).ToString();
string[] allowedExtensions = { ".gif", ".jpeg", ".jpg", ".png" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOk = true;
if (fileOk == true)
{
if (!Directory.Exists(fileFolder))
{
Directory.CreateDirectory(fileFolder);
}
filePath = fileFolder + fileName;
if (File.Exists(filePath))
{
msgBox.Text = fileName + " " + "already exists on the Web server";
return;
}
FileUpload1.PostedFile.SaveAs(filePath);
Image1.ImageUrl = filePath;
I need help on how to display the image.
Thanks.
Obinna from Nigeria.
//obinnaaj Eof
|
|
|
|
|
|
We are just about to start a new project that is going to get very big!!
In the past i have always used a different assembly for Business objects (with the DAL inside) and presentaion.
We have been thinking about how to structure the new app, and thought about having the DAL and BO in seperate assemblies (to spread the code out), but they need to refernce each other which you cant do.
How do you manage your code files? do you use assemiles or namespaces?
Any good articals that you have seen?
Thanks
|
|
|
|
|
mark_w_ wrote: do you use assemiles or namespaces?
Yes. DAL dll is imported into BLL dlls. BLL dlls are imported into presentation layer.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for your VERY quick reply ,
but
if i have a singleton in my BLL, and to create it i need to connect to the database (via the DAL), how would i do that?
Edit, the reason i need to do this is to read in what application level permissions the user has once so i dont have to keep going back to the database
modified on Monday, May 19, 2008 6:59 AM
|
|
|
|
|
mark_w_ wrote: but they need to reference each other which you cant do.
This sounds like it's slightly wrong. If you think about it, your business objects should not need to reference your data access layer. Why would your business objects need to know anything about how/where they are saved?
What I've got is an assembly called DataObjects, which is the basic business objects the app uses. They are pretty much dumb classes and don't really do anything beyond serving as storage structures. This assembly references nothing else apart from the basic .net stuff.
I have a DataAccess assembly which contains the classes that do things like load/save the DataObjects, this references the DataObjects assembly.
Then I've got a BusinessLogic assembly. This references both of the others and provides things like validation checks etc.
From the GUI level, the app doesn't reference the DataAccess assembly directly. Instead it references the BusinessLogic assembly and any saves/loads are performed through that.
Simon
|
|
|
|
|
Define an interface assembly to contain your contracts. This library will access no other solution assemblies but will be accessed by most if not all of them.
|
|
|
|
|
Hi,
Using an article from Code Project I have "globalized" my application however I think I have "over done it".
The user can select from English OR Spanish and then I run the following code...
CultureInfo objCI = new CultureInfo(MainForm.culture);<br />
Thread.CurrentThread.CurrentUICulture = objCI;<br />
<br />
this.xrLabelHeader.Text = MainForm.RM.GetString("0312");<br />
this.xrLabelAmtReceived.Text = MainForm.RM.GetString("0194");<br />
this.xrLabelSNumber.Text = MainForm.RM.GetString("0314");
This works fine but now I think I've stuffed it up for users that don't use Spanish or English (in this case en-US) because I haven't returned the culture back to the computers system after setting the text labels etc.
Presumably I should have read the users culture first, changed it whilst setting the text files etc, and then returned the culture back to the computers so that other formatting rules apply (currency symbol etc).
Can someone confirm the above please or point me in the right direction.
Thanks,
Glen Harvy
|
|
|
|
|
I'm not sure why you'd want to change the thread's CultureInfo back after you set it up. In this case you may want to write a ResourceManager wrapper to set various things without changing the thread's CultureInfo.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
I think I may be confusing myself with the UI Culture and the computers culture.
In my application I don't touch the computers culture and therefor I didn't think there would be a problem.
For example. the application's user can chose to set the UI culture to English or Spanish ie the labels/text in the program can be displayed in either English or Spanish. If they are using the program on a German computer then the dates etc will still be in German. As you said, I could have ignored the culture altogether and just used the ResourceManager as a wrapper.
I'm trying to test all this on a VM but it's a bigger task than I imagined because the .Net version is in English so 'OK' is 'OK', not whatever is German for 'OK'.
What triggered my 'panic' was that I have a Kuwaiti prospective customer who wants to get rid of the '$' and presumably use 'KD'. I paniced because I would have expected it to use 'KD' or whatever currecy symbol is appropriate for the users region. Apparently there is no region specific culture for Kuwait so I think my application is performing as it should anyhow.
Thanks for your input - it seems I only needed to talk it through.
Glen Harvy
|
|
|
|
|
In C#.Net2.0, I created one control. I want to use that control in my other application. How to customize the user control in .Net 2.0. Thanks in advance.
|
|
|
|
|
copy the code across, or just put it in a dll and reuse it from there.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
It may be simple question. When I build/Rebuild the solution, I found only .exe and .pdb files in bin/Debug folder. I didn't find .dll file.
|
|
|
|
|
That's b/c there isn't one. I said you have to make one. This means making a whole new class libary project and moving the code into it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I used _paint event in my class, which is not possible to create the same in class library project.
Is there any other way to include the custom control in my application. Please guide me.
|
|
|
|
|
Hi All,
I am developing an application for some network utility. Right now looking for a .Net library function to compress files before I send them via network. I tried to work with “System.IO.Compression” namespace. But it supports only gzip, which cannot be opened directly with Winzip. Also I am looking at supporting multiple compression formats such as zip, tar etc. I even tried of using #ZipLib. But for some reason I don’t want to use any 3rd party library. Can anybody suggest me how can I achieve this just using .Net libraries.
Thanks in advance,
Krishnaraj
|
|
|
|
|
I think J# has a library you can reuse. Apart from that, if you don't want to use ZipLib, you'll have to rewrite it yourself.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
The Compression namespace only does the actual compression. To turn it into a .zip archive, you basically just add a header before the data. If you only ever put a single file in the archive, most of the header looks the same all the time, so that would be pretty easy to write yourself.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
We generally use #ZipLib[^]. There's an exception which allows it to be used freely in commercial, closed-source products.
If you're insistent on doing it only with the supplied libraries, and don't want to go the J# route, System.IO.Compression provides an implementation of the Deflate algorithm in the DeflateStream class. You will need to Deflate each file and write headers as noted in the ZIP Application Note[^], the specification for Zip files.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi,
Can anybody help me how to attach & detach child windows from a parent window such that when they are attached they should move along with the parent window whenever we drag either the child windows or parent windows on the desktop.
Thanks
|
|
|
|
|
youwould nee move the window yourself in code.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|