|
Hi buddies,
I had an xml like "<Pu><Name>Joe&&&&&&&</Name><Age>redroom</Age></Pu>"
when i am tried with the code in c# as,
1.
tmp_Message = "<Pu><Name>Joe&&&&&&&&&&&</Name><Age>redroom</Age></Pu>";
XmlDocument xXD = new XmlDocument();
xXD.LoadXml(tmp_Message);
it is throwing error.
2.
can i get any function to check, if a given string is a proper xml or not in C#
please..... help me ..!!!! in solving this error.
regards,
vinu
|
|
|
|
|
Of course is XmlDocument.LoadXml() throwing an exception, because of all the ampersands in your string.
They must be escaped as &
Using LoadXml() in a try/catch is a way to check for proper XML.
Regards,
mav
|
|
|
|
|
hi mav,
it is not throwing error if i escaped with a single & if i use like &&&&&&&&&& then it is throwing error.
i think its not a good way, if i use try/catch to check.
please help with a solution.
vinu
|
|
|
|
|
hi mav,
it is not throwing error if i escaped with a single & if i use like &&&&&&&&&& then it is throwing error.
i think its not a good way, if i use try/catch to check.
please help with a solution.
vinu
|
|
|
|
|
Of course you have to escape every & as & .
If you do this, the xml string is correct and no exception is thrown.
AFAIK there's no ValidateXml method available, so trying to load the string and looking for an XmlException seems to be a reasonable way.
Regards,
mav
|
|
|
|
|
Thanks mav.
Regards,
Vinu
|
|
|
|
|
Thanks very much. its working now......
Vinu
|
|
|
|
|
Hi c# buddies,
I had an xml like "Joe&&&&&&&redroom"
when i am tried with the code in c# as,
1.
tmp_Message = "Joe&&&&&&&&&&&redroom";
XmlDocument xXD = new XmlDocument();
xXD.LoadXml(tmp_Message);
it is throwing error.
2.
can i get any function to check, if a given string is a proper xml or not in C#
please..... help me ..!!!! in solving this error.
regards,
vinu
|
|
|
|
|
I've posted this in the database section and got no response, so I thought I'd try here...
I need to export the contents of an SQL2000 table to a flat dbf file without any user intervention - Ie I don;t want them to have to use Enterprise Manager
Any ideas out there ???
Tks
Dave
|
|
|
|
|
whats the format for the DBF ? Is it dBase ?
I have a bunch of librarys in C to manipulate dBase databases, I'm sure it could be ported to C#
|
|
|
|
|
They are dBase III.
tell me more......
Tks
Dave
Tks
Dave
|
|
|
|
|
Well I might have jumped the gun a little bit. The library I have is from a product called CodeBase, its a real old version but I bet licencing restrictions still apply. If this is for buisness you can buy a current copy at www.codebase.com which supports .NET, but I think I have another solution. It will take some coding but I think it would work.
If your familiar with Office automation, this shouldn't be too hard.
1. Write a routine to export the Table data from SQL into a CSV file.
2. Use Excel Automation to open the CSV file and save as dBase III format.
I manually did the above tasks and got a valid dBase III DBF file (no index file though)
If you need help on the details...i.e. SQL Export routine or Excel Automation let me know.
I hope this idea works.
|
|
|
|
|
I was already working on a project that uses Excel Automation and was able to get Excel to export the WorkBook I was using into dBase III with the following line:
wsWorkSheet.SaveAs("c:\\temp\\NewDBF.DBF",Excel.XlFileFormat.xlDBF3,Type.Missing,Type.Missing,0,0,Type.Missing,Type.Missing,Type.Missing);
|
|
|
|
|
Michael
Tks - the Excel method looks possible, but its not something I've used before.
Does it mean that the user has to open up Excel to do it - if they do, then I may as well stick with Access reading the SQL table through an ODBC connection, as I am familair with that.
What I really want is something that does it all inside my .net app.......
Tks
Dave
|
|
|
|
|
Dave,
If you use Automation the user will not see a thing...You could have the whole processes linked to a single buttion click or no button at all.
|
|
|
|
|
In that case, where do I start....
Dave
|
|
|
|
|
Lets converse via e-mail rather then add 20 threads to the board....
|
|
|
|
|
Just wonedering if anyone has any idea of how to change the background color of specific items in a Listbox?
I would have thought that there might be a property like ListBox1.Items[1].BackColor or something similar but alas that does not exist?
|
|
|
|
|
I don't believe you can, I've tried this before.
My solution was to use a ListView in Report format.....
|
|
|
|
|
I actually solved my problem. The Listbox has a property called DrawMode which you set to OwnerDrawFixed. The ListBox then has an event called DrawItem which exposes a lot of properties like BackColor, its Bounds etc which give you all the necessary things to force the drawing of the ListBox.
|
|
|
|
|
del.icio.us links uses http auth. I send a link such as:
http://username:password@del.icio.us/api/posts/add?&url=http://www.engadget.com/&description=engadget&extended=engadget&tags=blog&dt=3/10/2005 12:34:49 AM
with my username and password, and I get the little xml snippet via html <result code='done'>
If I try to grab this result code with
<br />
<br />
<br />
string lcUrl="http://username:password@del.icio.us/api/posts/add?&url=http://www.engadget.com/&description=engadget&extended=engadget&tags=blog&dt=3/10/2005 12:34:49 AM"<br />
HttpWebRequest loHttp =<br />
(HttpWebRequest) WebRequest.Create(lcUrl);<br />
<br />
loHttp.Timeout = 10000;
loHttp.UserAgent = "code I borrowed trying to do this dang-it!";<br />
<br />
HttpWebResponse loWebResponse = (HttpWebResponse) loHttp.GetResponse();<br />
<br />
Encoding enc = Encoding.GetEncoding(1252);
<br />
StreamReader loResponseStream =<br />
new StreamReader(loWebResponse.GetResponseStream(),enc);<br />
<br />
string lcHtml = loResponseStream.ReadToEnd();<br />
<br />
loWebResponse.Close();<br />
loResponseStream.Close();<br />
<br />
I get the 401 error. I am trying to stream out the result code so I can store it in a string variable.
Any guidance is appreciated.
|
|
|
|
|
I search in Google and found only in RichtTextBox. But I want to retrive in everywhere. Help me Please.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
KERNEL32.DLL
|
|
|
|
|
Hi,
I have two panels on a C# WinForm contains set of buttons with shortcut (eg. Alt+K) on each Panel.
Now when the user is on one panel, the shortcuts of other panel buttons are not functioning. Same way when we place a UserControl on one of the panel.
Also, when the user is in a textbox below the Button on the same panel, button short-cut is not working.
Is there any solution for this problem??
Thanks in advance.....
Regards
Sundar
|
|
|
|
|
Hi all.
I've written a program that uses the joystick port to interface with a coin mechanism. I am using joySetCapture, etc via pinvoke. It all worked fine in testing, but in the real world, apparently sometimes the capture fails, and sometimes it breaks after time. What can I do, apart from install DX ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi Christian!
joySetCapture is having problems under XP. The first capture works, trying to re-capture the joystick after a joyReleaseCapture always fails.
I've solved a similar problem by not using joySetCapture and joyReleaseCapture , but using joyGetPos() and doing the polling myself. For joyGetPos to work you don't have to capture the joystick, so it can be called as often as you want.
Regards,
mav
|
|
|
|