|
Thanks for reply sameer,
both my xml files have same structure.
have u any example of class serialization to compare xml file... ??
thanks in advance
koolprasad2003
Rating always..... WELCOME
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
hi prasad,
Here a link how you use Xml serialisation in C# http://msdn.microsoft.com/en-us/library/ms950721.aspx
1)your need to build your own class as same stucture as that of the Xml
2) then populate the data in class using XmlReader and input both the files http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.aspx
3)create instances of class created with two files
4)maybe override the = operater to generate the report of what all data on which tag differ
Hope i am clear!!!
Best Of Luck Buddy!!
Samir
|
|
|
|
|
Let me get this straight.
for 2 xml files which have the same structure you would deserialize your xml into classes and override the whole map's equals functioality and then compare your 2 maps to try to determine if there are any differences.
instead of, say, just comparing the xml to each other using string comparison?
|
|
|
|
|
J4amieC wrote: instead of, say, just comparing the xml to each other using string comparison?
Come on, thats far too easy. Where's the opportunity to create abstract classes, interfaces, several layers of inheritance, sub-classes and all the rest of the bloat so it looks like we are earning our crust
Bob
Ashfield Consultants Ltd
Proud to be a Code Project MVP
|
|
|
|
|
hi, follow the two links below.
http://forums.devx.com/showthread.php?t=168067
http://www.daniweb.com/forums/thread46345.html#
best regards.
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:55am.
|
|
|
|
|
Hi,
As the subject states I'm a complete newbie in programming.
I've coded a little program that uses picture boxes to display images of dices.
After filling the picture boxes with an image a PictureBox[pictureBoxNumber].Image.Dispose() is executed.
All the loops I'm using work fine, but if I press the "Alt" or "Alt Gr" key on the keyboard after the button_Click event has run an ArgumentException gets thrown.
The stack trace doesn't make me any wiser though. I've copied it to be able to post it so here it is:
bij System.Drawing.Image.get_Width()
bij System.Drawing.Image.get_Size()
bij System.Windows.Forms.PictureBox.ImageRectangleFromSizeMode(PictureBoxSizeMode mode)
bij System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)
bij System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
bij System.Windows.Forms.Control.WmPaint(Message& m)
bij System.Windows.Forms.Control.WndProc(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bij System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bij System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bij System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bij System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bij System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bij System.Windows.Forms.Application.Run(Form mainForm)
bij prjDices.Program.Main() in E:\Mijn documenten\Visual Studio 2008\Projects\solTeerlingen\prjTeerlingen\Program.cs:regel 18
bij System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
bij System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bij Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bij System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bij System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bij System.Threading.ThreadHelper.ThreadStart()
I've been trying to figure out what happens for quite a while now but to no avail.
I'm really completely stuck on this.
If someone could help me understand what causes the exception I'd be very thankful.
I'm not asking for a solution just help to figure out what in heaven's name is going on.
Thanks in advance,
Jeff
|
|
|
|
|
I'm curious as to why you Dispose() of the images?
they are in use in the picture box, so disposing them will lead to problems!
maybe that's even the cause (for some twisted reason) of your mysterious problem.
but do dispose of the images, ONCE you got rid of them!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi Super Lloyd,
Thanks for responding.
About the reason to dispose of the images.
In an application I wrote earlier a picture box control was also used.
When starting the application I also started task manager and observed what happened.
The picture boxes really eat away memory if the images are not disposed of.
Greetz and thanks,
Jeff
|
|
|
|
|
you can't successfully call Dispose() on an Image inside a PictureBox.
this would be the proper way to switch a PictureBox from image1 to image2:
Image newImage=...;
Image oldImage=pb.Image;
pb.Image=newImage;
if (oldImage!=null) oldImage.Dispose();
|
|
|
|
|
Hi Luc,
Thanks for replying.
You made me think about what was going on and yes sir problem solved.
Seeing that I disposed of the images after every loop it's quite obvious that in the next run no images were available.
The solution was actually fairly easy.
Before I dispose of the image I use a boolean expression to determine whether or not an image is present.
Like this:
if (PictureBox[pictureBoxNumber].Image != null)
{
PictureBox[pictureBoxNumber].Image.Dispose();
}
Greetz and thanks for the insight,
Jeff
|
|
|
|
|
that is not good enough, you can't dispose of that image as it is still in use by the PictureBox itself,
you really should do it the way I have shown: copy the reference to a local variable, remove the image from the PictureBox, and only then dispose of it.
modified on Friday, January 15, 2010 7:40 AM
|
|
|
|
|
Hi,
my regex works fine in a regextest tool its just only when i try to filter the content via c# it doesnt work. here is my code
string fName = @"data.txt";
part of the content that should match
<div class="middleadimggold">
<a class="asdf" href="http://www.asdf">
asdf</a>
<p>
asdf</p>
<p>asdf</p><p>asdf</p>
<p><span class="blue">asdf</span>
<a class="de" href="http://www.4asdf"><span class="a">(See on map)</span></a></p>
<p><span class="blue">asdf</span></p>
<span class="xx">
asdf
</span>
</div>
please note the spacing in the content, not sure if it matters?
modified on Thursday, January 14, 2010 10:06 PM
|
|
|
|
|
ok this fixed the problem
if (Regex.IsMatch(allRead, regMatch, RegexOptions.Singleline)
singleline option that is. thanks for nothing
|
|
|
|
|
Didn't I tell you that yesterday[^]?
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
you have asked question by your-self and replied it back too again with answer already given by someone.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
How to convert Any type file (bmp,Jpg,jpeg etc...)to binary or blob file to store it in sql 2005.
|
|
|
|
|
Any file (including text file) is a binary file. You can treat any file as a binary large object (blob) to be stored in a database. You don't need to do any conversion. Any comments on this opinion are welcome.
|
|
|
|
|
correct. Any file is binary, some files also are text files, others also are image files, etc.
|
|
|
|
|
|
I am trying to use the amazon web services in my c# program but I kept getting a http 410:gone error.
I did some research and found webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl is suppose to be the correct web reference. In any event, the following appears to be obsolete and I can not find it replacement. What I am wanting to do is query amazon based on a title and return the price.
I thought AmazonSearchService srchrequest = new AmazonSearchService(); would work but that appears to have been replaced and i haven't a clue with what. I thought maybe AWSECommerceService srch = new AWSECommerceService();
Then also the KeywordRequest kr = new KeywordRequest(); has been removed. so I guess how do you do keyword searches now?
I was hoping to do something like this
ProductInfo pi = srch.KeywordSearchRequest(kr);
Details[] allDetails = pi.Details;
allDetails no longer exist either
Am I going about this all wrong or what? I can't seem to figure it out..
The closest I see are two things in the object brower. Price and then itemsearchrequest but I can't seem to figure out how one would use that to get the price of the item.
any help or a reference to a working tutorial or something would be great.
thanks
|
|
|
|
|
This documentation[^] may be of some help.
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Thanks for that link..
Here is something I came up with but for some reason It keeps throwing an exception.
The assembly with display name 'book list project.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1.
The cause of the failure was: System.IO.FileNotFoundException:
Could not load file or assembly 'book list project.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified.The assembly with display name 'book list project.XmlSerializers' failed to load in the 'LoadFrom' binding context of the AppDomain with ID 1.
The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'book list project.XmlSerializers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
here is the code I'm calling:
private void btn_GetPrice_Click(object sender, EventArgs e)
{
AWSECommerceService aws = new AWSECommerceService();
ItemSearchRequest request = new ItemSearchRequest();
request.SearchIndex = "Books";
request.Power = "title:" + titleTextBox.Text;
request.ResponseGroup = new string[] { "Small" };
request.Sort = "salesrank";
ItemSearchRequest[] requests = new ItemSearchRequest[] { request };
ItemSearch itemSearch = new ItemSearch();
itemSearch.AssociateTag = "XXXXXX";
itemSearch.SubscriptionId = "XXXX";
itemSearch.Request = requests;
try
{
ItemSearchResponse response = aws.ItemSearch(itemSearch);
Items info = response.Items[0];
Item[] items = info.Item;
for (int i = 0; i < items.Length; i++)
{
Item item = items[i];
priceTextBox.Text = item.ItemAttributes.ListPrice.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
|
|
|
|
|
how to convert string like 0.5555 to rounded double value of 0.6 in this case? Because when i use Convert.ToDouble("0.555555") the result is 55555555..
Thanks
|
|
|
|
|
Hi,
the Convert class (or the Parse methods of several classes) will turn a string into a numeric value that matches the string as good as it can. There is no way around that.
You can change the result by adding another statement that operates on the numeric variable, something like double d=Math.Round(d,1); . AFAIK there isn't a single statement that will do both at once.
read up on the Math.Round() method.
|
|
|
|
|
Still..you can't convert string 0.555 to double value 0.555? Always removes 0 from first place..i used another more complicated way..i separate string..i get second decimal..check if it is greater than 5..if yes i inc first decimal and at the end i put numbers converted to string back together.
|
|
|
|