|
I have downloaded your component today and it looked very promising. But I have a problem. My XML files begin with the following line:
<?xml version="1.0" encoding="UTF-8" ?>
With this line XMLite thinks it is not a valid XML file.
Any idee how this can be fixed.
|
|
|
|
|
i sorry that current xmlite doesn't understand xml PI (Processing Instruction).
just simplely XMLite is maded for plain xml text.
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
I've played with that parser for a few days and something strange happens in some cases. Very strange... I used this class to serialize another XML document to be parsed later on the client side. But undoubtly it wasn't correct.
I lost a few hours to understand this issue until I saw the next statement in the GetXML method:
strRes += (opt->reference_value&&opt->entities?opt->entities->Entity2Ref(value):value);
I thought it looks vey strange to be correct After that statement executes the next operation didn't work:
strRes += _T("
|
|
|
|
|
Thanks, Sergey Zhiharev!
I try to get that bug on my test.
but i can't get the bug...
if it checked to me, it will help to fix..
can you show me the way to get the bug? thanks!!
btw, it's right. CString s has more length..
it can be fix with freeextra() simplely .
int len = _tcslen(str) + nEntityCount*10 ; // MAGIC!!!
LPTSTR sbuf = s.GetBufferSetLength( len+1 );
if( sbuf )
Entity2Ref( str, sbuf, len );
s.FreeExtra();
have a good day
and i want to see the bug and i hope to fix!
thanks again
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
fixed new function..
LPTSTR _tcsechr( LPCTSTR psz, int ch, int escape )
{
LPTSTR pch = (LPTSTR)psz;
while( pch && *pch )
{
if( *pch == escape )
pch++;
else
if( *pch == ch )
return (LPTSTR)pch;
pch++;
}
return pch;
}
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
please replace function in xmlite
LPTSTR _tcsskip( LPCTSTR psz )
{
//while( psz && *psz == ' ' && *psz == 13 && *psz == 10 ) psz++;
while( psz && isspace(*psz) ) psz++;
return (LPTSTR)psz;
}
now XMLite can parse correctly below xml.
<tag
="" a="1
" b="2
/">
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
Thanks very much for your work!
I used your code in my new project and I very appreciate it. I only make some very small modifications for VS 2003 compatibility (removing some warnings) and I added a short method to load an xml from a file.
If you want you can download this small changes with my project from http://www.devage.com/dotNetInstaller/dotNetInstaller.html.
Thanks
Davide
|
|
|
|
|
you did great job, too.
i also feel thanksful to you for showing the way to vs 2003. davide.
your contribution must be help me or other.
thanks.
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
Only say that It's a great class, I've been looking around for a XML parser and I can say this is the best and easiest parser I found. Great job...........
|
|
|
|
|
it's my pleasure.
thanks for using. i also think XMLite is easy to use. only that is the reason why i make it. thx.
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
adding support for encoding and/or dtd's? Seem like being some of the very basics of XML.
int x1=4, y1=8; x1^=y1^=x1^=y1; // whats the content of x and y now?
|
|
|
|
|
thanks for regards.
yes, you can say that again.
I think wonderful if XMLite can support DTD and XML Schema and XSL translation or more. yeah.
and what you said might be real basic functions of xml parser.
I hope XMLite can do that with my or someone's efforts.
thanks !
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
Hi Kyung-min,
I’m using your parser in my code, is really a good and simple parser, but a have a problem when I try to get a value or an attribute that has a back slash.
For example:
<file path="c:\\mypath\\file1.exe">Example
When I get the attribute it come like "c:mypathfile1.exe"
There is a way to read the back slash
Thanks,
Bulha
Bulha
|
|
|
|
|
thanks for using.
back slash is escape character in xmlite on default.
but that's my fault.
( on my previous project, default escape character is needed.
so i added it but it bad on your general case )
so. I decided to edit my XMLite code.
get updated XMLite source code plz.
now i add property 'escape_value'.
default is no escape character in XML value string.
if still you can use escape character as '\\', pi.escape_value = '\\'.
have a good day!
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
Thanks Cho,Kyung-min
have a nice day!
Bulha
|
|
|
|
|
I have written recursive function and at any moment in destructor(_tagXMLNode::~_tagXMLNode()) there is a error: writing to the inaccessible area of memory.
What to do?
Jaccccc@hotmail.com
|
|
|
|
|
i can't understand. if you show sample code, then i can help u.
thanks for regards.
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
When i use this function(ConstructMenu):
error in destructor: writing in unaccessible memory block.
(sorry for my English )
<br />
HMENU CLT3App::ConstructMenu(XNode m_xml)<br />
{<br />
CMenu menuSub1;<br />
ASSERT(menuSub1.CreatePopupMenu()); <br />
for( int j = 0 ; j < m_xml.GetChildCount(); j++)<br />
{<br />
LPXNode child1;<br />
child1 = m_xml.GetChild(j); <br />
XNode xml1;<br />
xml1.Load(child1->GetXML());<br />
if (xml1.GetChildCount() > 0)<br />
menuSub1.AppendMenu(MF_POPUP, (UINT)ConstructMenu(xml1), _T(child1->GetAttr("name")->value));<br />
else<br />
menuSub1.AppendMenu(MF_STRING, 40000 + atoi(child1->GetAttr("id")->value), _T(child1->GetAttr("name")->value));<br />
}<br />
return menuSub1.Detach();<br />
}<br />
|
|
|
|
|
<br />
_tagXMLNode::~_tagXMLNode()<br />
{<br />
for( int i = 0 ; i < childs.size(); i ++)<br />
{<br />
<br />
LPXNode p = childs[i];<br />
if( p )<br />
{<br />
delete p; <br />
childs[i] = NULL;<br />
}<br />
}<br />
childs.clear();<br />
<br />
for( i = 0 ; i < attrs.size(); i ++)<br />
{<br />
LPXAttr p = attrs[i];<br />
if( p )<br />
{<br />
delete p; <br />
attrs[i] = NULL;<br />
}<br />
}<br />
attrs.clear();<br />
}<br />
|
|
|
|
|
now i can understand what is problem.
you can solve it like below,
HMENU CLT3App::ConstructMenu(XNode m_xml)
to
HMENU CLT3App::ConstructMenu(XNode& m_xml) // no call by value.
// 'call by value' needs deep-branch-copy, and time overhead.
now XMLite doesn't yet supports 'deep branch nodes copy'
Yet I haven't plan add function of branch-copy and branch-insert.
If you think it's funny, then try to add it. and show the code for all
thanks
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
|
Just another suggestion.
Since you use lots of STLs, why still using MFC's CString?
Perhaps in the next release, you want to switch all CString to string. Of course, some minor reconstruction is needed.
|
|
|
|
|
thanks for your suggestion.
already i used std::string.
if you want to change CString to std::string.
i can offer my tiny std::String class.
i made tstring to use like CString.
as you know std::string don't know formatting and bore to use of 'c_str()'.
so i use tstring for my non-MFC code.
thanks.
#include <tchar.h>
#include <string>
//=================================================================
// string utility class
// : std string for UNICODE or MBCS
template< class stl_string >
class stringex : public stl_string
{
public:
stringex() {}
stringex( LPCTSTR psz ) { assign( psz ); }
operator LPCTSTR () { return c_str(); }
operator =( LPCTSTR psz ) { assign( psz ); }
inline void format_v( LPCTSTR psz, va_list argList )
{
resize( 1000 );
resize( _vstprintf( (TCHAR*)data(), psz, argList ) );
}
inline void format( LPCTSTR psz, ... )
{
va_list vl;
va_start( vl, psz );
format_v( psz, vl );
va_end( vl );
}
#ifdef _WINDOWS
// for windows
inline void format_v( UINT id, va_list argList )
{
TCHAR psz[256];
::LoadString( NULL, id, psz, sizeof(psz) );
resize( 1000 );
resize( _vstprintf( (TCHAR*)data(), psz, argList ) );
}
inline void format( UINT id, ... )
{
va_list vl;
va_start( vl, id );
format_v( id, vl );
va_end( vl );
}
#endif // _WINDOWS
};
#ifdef _UNICODE
typedef stringex<std::wstring> tstring;
#else
typedef stringex<std::string> tstring;
#endif
Thank you all. No one know oneself all. My idea from you, book, all others. already we are shared brains.
|
|
|
|
|
I actually try to use to stl string myself too. I change CString.GetBufferSetLength() to string.resize() and string.data(). However, I think I must screw up something else which causes the library is not working anymore. Appreciate if you can publish the source code that works with stl string. Thanks.
|
|
|
|
|
Hi,
I want to develop a simple JabberClient in c++,
do you have a sample ? the MFC from pgmilliard don't work
best,
Cyril
|
|
|
|