|
kakan wrote: Well...
It's pretty hard to to use the SAX API (as I suggested), if the parser in question doesn't support it
Oops, sorry - slipped into work document-reviewing-mode. Comment still stands though
K
|
|
|
|
|
I looking for a library working like:
ParseXMLFile(file...,callback )
{
while( scanning file...){
.....
callback.OnEnterNode( nodeName, attributes...)
....
.. processing XML formatting...
....
callback.OnExitNode( nodeName )
}
}
|
|
|
|
|
That's what (a parser with a) SAX-api does!
You register callbacks for the events you are interested of.
Then you call the parse() function in the parser, and it calls your callback functions when appropriate.
And it does this "on the fly", that is: while it's reading the XML file.
So it's exacly what you want!
You might be interested in checking MSXML out. It has got a SAX API.
There are heaps of samples how to use SAX on MSXML.
Kakan
|
|
|
|
|
I think MSXML supports both SAX and DOM way of parseing the xml file. It would be good thing to use unless you dont want to use COM in your application.
-Prakash
|
|
|
|
|
|
kakan wrote: Yes, it does.
thanx :->:->
-Prakash
|
|
|
|
|
For standard C++ programming and also WTL programming, is VC++ 2005 a lot better than 2003 ?
Is the IDE a lot better in 2005 ?
Is it worth upgrading from 2003 to 2005 ?
|
|
|
|
|
I dont know about you but I find the new Visual C++ to be a lot cleaner than the previous VC++. The simple reason being the concept of partial classes where the code wizard writes code in a separate file but for the same class. So there is 1 file with your implementation and one with the code gen. There is no need to find you way through the code and make changes or insert code as in 2003 at times. It does not support .net 1.1 framework but does it for .net 2.0. The GUI that u can build is very Office 2003 like...so it looks updated
cheers
Rahul
|
|
|
|
|
Yes, it is worth upgrading.
Someone blamed for my nickname to be destructive, I wonder what he would have said about yours
~RaGE();
|
|
|
|
|
I ave tryed 2003 and 2005 but after some disaventure (serialization of CObject defined in extension DLL see IMPLEMENT_SERIAL_EXTDLL ecc.. distributing executables ecc..) I use VC++ 6!
|
|
|
|
|
The upgrade is worth doing.
topus wrote: I use VC++ 6!
But yes, VC++ 6 still ROCKS!
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
;P
not so bad, but quite old nowaday
i still use it, but only when i maintain a project a create under VC++6 that i don't want to port to VC++7.1.
now, when i create new projects, i use VC++2003 (i don't have VS2005 except a beta2), and i find it pretty cool compared to VC6 (which keep me nostalgic )
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
topus wrote: I use VC++ 6!
Yep, still a good IDE but there are some minor bugs with the compiler. If I remember correctly (not sure anymore), you will have compile errors when you have a class with a private destructor and a public function that auto-deletes the object (something like):
void MyClass::Destroy()<br />
{<br />
delete this;<br />
}
The compiler will tell you that the class cannot access the destructor as it is private.
There were also some minor bugs with the STL I think but I cannot remember anymore which ones.
|
|
|
|
|
|
Morning, got a quick question here
<br />
for(std::vector<std::string>::iterator iterString = myVec.begin(); iterString != myVec.end(); ++iterString)<br />
{<br />
if (*iterString == "someText") *iterString = "someOtherText";<br />
else if (*iterString == "someText2") *iterString = "someOtherText2";<br />
else return(-1);<br />
return(0);<br />
}<br />
Will changing a vector item using this kind of operation invalidate the iterator?
I cannot red it up: No docs, no books here, just the compiler, libs and web access.
Thanks in advance.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
I would be very astonished if it does. Think of an iterator as a kind of pointer: when you access and change the content of the pointed data (with the * operator), it doesn't change the pointer itself so it is still pointing at the same 'address'.
Altought I never tested it before so I cannot say that will work. But still, this would be very illogical if you can't do it.
|
|
|
|
|
i think that such a question sebastian asked is justified when you know Java iterators... they actually invalidate when you try to modify the element they point on (or something very close).
but even if it is not the case in C++ (because modify the element will not reallocate automatically a new instance - which makes the iterator loose its address), i can understand his doubt...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VisualCalc 3.0]
|
|
|
|
|
Thanks for you help, you two.
Actually, I was concerned with the "dynamic" nature of a vector. I was not sure how vectors handled resizing. I mean, I did not consider the nature of the std::string and std::vector. But your statements make sense: Even if the string did grow during my change, that would not require the vector to grow, since the string itself handles its own "dynamic size", not the vector containing it.
Its a typical case of "not thought through"
Thanks again.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
This will not invalidate the iterators. Things what will:
- Inserting a item at the end **IF** reallocation occurs as a result.
- Inserting an item invalidates all iterators the refer to items after the inserted item and if reallocation occurs all iterators.
- Deleting an item invalidates all iterators the refer to items after the deleted item and if reallocation occurs all iterators.
I think that about covers it.
You can use the reserve function to specify how much storage to allocate so reallocation does not occur.
Steve
|
|
|
|
|
I have 2 classes, CPerson and CPersonDlg. Look at their relationship:
Person.h
--------
#include "PersonDlg.h"
class CPerson
{
...
public:
friend class CPersonDlg ;
...
} ;
PersonDlg.h
-----------
#include "Person.h"
class CPersonDlg
{
...
public:
CPerson m_pers ;
...
} ;
Person.cpp
----------
#include "Person.h"
....
...
PersonDlg.cpp
-------------
#include "PersonDlg.h"
...
...
PROBLEM
=======
I am getting the error "fatal error: unexpected end of file while looking for precompiled header directive". But If I add "#include "stdafx.h" in Person.cpp, I get another error "CPerson: class type redefinition"
Pls suggest me a solution.
Thanks in advance
Sarvan AL
|
|
|
|
|
In the project settings (right click on project in solution explorer -> properties) select "C/C++" and change "Precompiler headers" to "Not using precompiled headers". I also suggest removing stdafx from your source-code.
And: remove the circular includes, thats giving me the creeps. Have PersonDlg.h include Person.h.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
-- modified at 4:03 Thursday 12th January, 2006
|
|
|
|
|
Sarvan AL wrote: I am getting the error "fatal error: unexpected end of file while looking for precompiled header directive". But If I add "#include "stdafx.h" in Person.cpp, I get another error "CPerson: class type redefinition"
To solve the first error you have to #include "stdafx.h" . To solve the second error place a #pragma once at the top of every one of your .h header files. What is happening now is that the compiler is including person.h multiple times so it is finding multiple definitions of class CPerson .
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
1. I have one similar problem please help me also. I tried to use a global variable in every c++ file with the same name that is szRegPath (a CString). But I got some error and I had to use either different variable names in all the files (if global) or i had to put those inside functions. How can I resolve this?
2. I want to have one int variable which is global to all the c++ files and that should maintain its value state. If one file modifies the value to 7, then when it is called by another file, it should have its value as 7.
Please help me
Aljechin Alexander
|
|
|
|
|
Declare the variable as external using "extern" in all the files.
(like ... extern CString szRegPath). Hope this helps.
Pls let us know your status.
|
|
|
|
|
I will try this and definitely write back
Thank you so much
Aljechin Alexander
|
|
|
|