|
hi all
i am reading XML using XMLTextReader but can't get whole line
my XML is as follows
<para>This is test <b>XML</b> yes </para>
when i read
XmlReaderObject.Value then i get only [B]This is text[/B]
but i want whole line as
[B]This is test <b>XML</b> yes [/B]
how can i code it ???
any hint ??
thankx in advance
koolprasad2003
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
You're asking for the root node. This is poorly formed XML, to say the very least. Perhaps XMLTextReader demands a higher standard ? I don't know, but if you use XMLDocument, I'd expect the root contents to give you what you want. Your XML format sucks tho.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Adding to what CG said,
XML parser will take <b> as a new node rather than taking as the content of <para> . You need to read about CDATA[^] section and create a well formed XML.
|
|
|
|
|
Oh, I didn't even spot that the b was html, I never use b, I use em and strong in my HTML.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
my decoder cannot detect picture of webcam. i change the brightness and contrast. some time can detect but some times cannot. i know thats picture problem. now i edit the image but its useless. can i change webcam setting or do any changes to my code..here is my code....
private void btnDecode_Click_1(object sender, EventArgs e)
{
try
{
DeviceManager manager = new DeviceManagerClass();
Device d = null;
foreach (DeviceInfo info in manager.DeviceInfos)
{
d = info.Connect();
}
Item item = d.ExecuteCommand(CommandID.wiaCommandTakePicture);
foreach (string format in item.Formats)
{
WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile;
{
}
imagefile.SaveFile("d:\\4.jpg");
Bitmap image = new Bitmap("d:\\4.jpg");
Bitmap bm = new Bitmap(image, 200, 150);
System.Drawing.Bitmap TempBitmap = bm;
float brightness = 0.6f;
float constrast = 6f;
System.Drawing.Bitmap NewBitmap = new System.Drawing.Bitmap(TempBitmap.Width, TempBitmap.Height);
System.Drawing.Graphics NewGraphics = System.Drawing.Graphics.FromImage(NewBitmap);
float[][] FloatColorMatrix ={
new float[] {constrast, 0, 0, 0, 0},
new float[] {0, constrast, 0, 0, 0},
new float[] {0, 0, constrast, 0, 0},
new float[] {0, 0, 0, constrast, 0},
new float[] {brightness, brightness, brightness, 1, 1}
};
System.Drawing.Imaging.ColorMatrix NewColorMatrix = new System.Drawing.Imaging.ColorMatrix(FloatColorMatrix);
System.Drawing.Imaging.ImageAttributes Attributes = new System.Drawing.Imaging.ImageAttributes();
Attributes.SetColorMatrix(NewColorMatrix);
NewGraphics.DrawImage(TempBitmap, new System.Drawing.Rectangle(0, 0, TempBitmap.Width, TempBitmap.Height), 0, 0, TempBitmap.Width, TempBitmap.Height, System.Drawing.GraphicsUnit.Pixel, Attributes);
Attributes.Dispose();
NewGraphics.Dispose();
picDecode.Image = NewBitmap;
break;
}
QRCodeDecoder decoder = new QRCodeDecoder();
String decodedString = decoder.decode(new QRCodeBitmapImage(new Bitmap(picDecode.Image)));
txtDecodedData.Text = decodedString;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
A S E L A
|
|
|
|
|
Your problem is not going to change. A webcam photo of a barcode is never going to be a scanned image of a barcode, and you need a much more complex algorithm to read it. I would imagine you could do some sort of auto cleanup to make sure the lines are straight ( a deskew ) and that the brightness/contrast levels are good, but I don't think you will ever get 100% success.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
ya but how they do the mobile barcode decoder...? i mean mobile phone application...how it works...?
A S E L A
|
|
|
|
|
With a ton of image processing to find the barcode amongst the noise. That's what I keep telling you.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
hi can just please tell me what kind of filters i should do for the omage....
noise filer and etc?
A S E L A
|
|
|
|
|
I told you already. You need to deskew, you need to remove noise and you need to get your balance right
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Christian Graus wrote: I told you already
What's this he asked for the codz - why won't you snd the codz, advice will not get the job done he needs the codz......
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I wanted to get a call chain(stack trace) starting from my code extended to a third party library which I don't have the source code access - the type of call chain shown in the exception window in visual studio when an exception occurs. How can I do that? I'm using VSTS 2008.
In addition, is there any difference between "call stack" and "stack trace"?
Thanks,
|
|
|
|
|
Hi,
Environment.StackTrace
A "stack trace" is the result of walking on the "call stack" to find methods and line numbers that have lead to the current position. They often are used interchangeably.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Thanks for the reply.
With the method I was able to see the previous stack trace that I can "step into", but when it came to untouchable third party calls in between, it didn't work.
Thanks,
|
|
|
|
|
hi friends, and wanna ask you:
1. what is the different between this code
catch (OleDbException ex)
{
throw ex;
}
and
catch (OleDbException ex)
{
throw new Exception(ex.Messege);
}
which is the best? or when should we use throw new Exception or just throw ex?
2. What about close() and dispose() method, what is the different?
if there is objek like OleDbDataReader which have close() and method() inside,
should we write objOleDbDataReader.close() and objOleDbDataReader.dispose() together in our code? why?
if we should only use one of them, which one should we use, close() or dispose() ?
Thanks..
Regards,
Willy
|
|
|
|
|
Hi,
welcome to CodeProject.
You could have found most of the answers yourself, by reading some of the documentation.
Here is a short reply:
1. new Exception(ex.Message) is non-sense, it is throwing away all information (inner exceptions, stack trace, whatever) and just keeping a one-line message.
2. simply catching an exception and throwing it again does not make much sense, you could as well not catch it in the first place.
3. the correct way to rethrow an exception is by just writing throw; which again only makes sense if you have more code in the catch block (e.g. logging something).
4. some classes have both a Close() and a Dispose() method, often one of these calls the other. Such details aren't very well documented, it helps to use this Reflector[^] tool which enables you to see a lot of internals of .NET classes.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
sky3913 wrote: should we write objOleDbDataReader.close() and objOleDbDataReader.dispose() together in our code?
Wrap it in a using block. Something like
using(OleDbDataReader objOleDbDataReader = ...)
{
} using is a syntactic shortcut and compiler will transform this to appropriate dispose calls. Read Implementing IDisposable and the Dispose Pattern Properly[^] to learn about dispose pattern.
|
|
|
|
|
Hi,
i have a service and i want it to run every 2 mins. i tried using
_service = new System.Threading.Timer(new TimerCallback(RunModules), null, 0,waitTime*1000);
but problem is that the service might not have finished its task and another instance of it runs. i want it to run every 2 mins, but if its instance is already running, it should not run until previous instance has finished.
Please provide insight to solution.
Thanx in advance.
|
|
|
|
|
you could stop the timer when it ticks, and start it again when the elapsed handler has finished; that would give idle periods of your choice and no overlaps.
in order to keep a steady pace, you could calculate the next interval you want to have, based on the current time when the handler starts and ends.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Hi,
What I want briefly is: for example I want to enter "erun" from keyboard and I want internet explorer to run or I want to enter "thk" from keyboard and I want it to be converted "thank you ver much, it's very usefull ... " string. for a programmer it will be very useful to get a long string with a few letters.These were simple examples.
I can use user32.dll but I've tried and couldn't find the way to get letters on this way. It's just running as shortcuts and this way if I assign all letters as shortcut to get them and combine as I wanted they are not be able to entered on the screen then.
Is there any other way or is there any way to do that?
thanks in advance .
|
|
|
|
|
kubibay wrote: What I want briefly is: for example I want to enter "erun" from keyboard and I want internet explorer to run or I want to enter "thk" from keyboard and I want it to be converted "thank you ver much, it's very usefull ... " string. for a programmer it will be very useful to get a long string with a few letters.These were simple examples.
I can use user32.dll but I've tried and couldn't find the way to get letters on this way. It's just running as shortcuts and this way if I assign all letters as shortcut to get them and combine as I wanted they are not be able to entered on the screen then.
Hello!
That's a vague query. I think that you are wanting to build a program, which will replace stuff as you type, on-the-fly (you will type the short form and the program will expand it)?
You will first need to tell us if you need this kind of functionality *just* in your application, or on the whole of the computer. If you wanted your app to perform this kind of task on the whole of the system, the problem is way more complicated than you think it could be. You will need a keyboard hook which will be listening to the keystrokes. And the listening module must be brilliant enough to know if I type "th" in notepad and "k" in excel. And on the other hand, how are you planning to put text into the window that is active ("thank you very much" in place of "thk"). How are you going to select "thk" and "replace" it with the new stuff? What if I start pressing keys in a window which has no typeable area? I can go on asking questions, but what the...
I've done the whole of this stuff before (I worked for a linguistic software firm, wrote a couple of input assistance engines which will predict words from a different language than what's the current one, based on the keyboard input and the current app configuration settings), but I doubt that you will be able to do something of this sort if you don't even know what's all is involved in this.
Ambitious project, sir. However, if you're dead serious, I'd like to tell you that this kind of an app is a perfect candidate for a native language programming language like C++. I shall assist you in that case.
It might also be that I *completely* misunderstood your query, but this is all I am able to make out from your question.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
First the project will be a windows project and will run on the taskbar as notify icon(maybe you can maximize if needed).
I am able to run : for example if I enter "Control + I" from explorer I can run Internet explorer or
If I enter "Control+T" from keyboard anywhere on the screen (it's not necessary any typeable area, you can type anywhere) I can convert it("Control+T") to "Thank you very much... ".
You can see the code sample here: http://www.pinvoke.net/default.aspx/user32.RegisterHotKey[^]
But it's working as shortcut so if:
I use letters for shortcut then I will not be able to enter them to the screen because of they're shortcut.
I want to enter "erun" anywhere in screen even not typeable area and want to run Internet explorer by program.
Is it possible?
|
|
|
|
|
kubibay wrote: Is it possible?
Did you read my reply to you before you posted this? I said that you will need to hook to the keyboard. If you don't know what this means, I shall not be able to help you. I also insist that if at all you go about doing this, do it in C/C++ as this is a clear candidate for native language programming.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|