sizeof( xml) - should be 4 if pointers on your platform use 4 bytes (32bit
pointers) - char *xml declares xml to a pointer to a char. xml = new char[
1000 ]; merely sets xml to point to the first char allocated. the pointer
xml itself has no idea how many bytes/chars it is actually pointing to.
On the other hand if you want to know how many char's your buffer is: either
use a static buffer so sizeof( xml )/sizeof( xml[0] ) gives total number of
char's used or keep track have how many char's you allocated for your
buffer.
sizeof( *xml ) won't work either - it should be give 1 if sizeof( char ) ==
1
> -----Original Message-----
> From: Tasso Angelidis [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, August 02, 2001 2:48 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: How To pass strings to the parser?
>
> Ok i got it working by doing the following...
>
> char *xml;
>
> xml = new char [1000];
>
> strcpy(xml, "<?xml version=\"1.0\"?><root></root>");
>
>
> XMLCh ch;
> MemBufInputSource *src = new MemBufInputSource((XMLByte*)xml, 100, &ch);
>
> The problem now is that sizeof(xml), returns the wrong size! It returns
> 4!??
> why?? if for example I replace the 100 by sizeof(xml) and run the
> application it will give me a parsing error saying the processing
> instruction is unterminated...
>
> -----Original Message-----
> From: Wuebben, Anthony E. (LNG) [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 02, 2001 1:42 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: How To pass strings to the parser?
>
>
> Use a MemBufInputSource and pass this to the parser
>
> memBuf = MemBufInputSource((XMLByte*)xml, sizeof(xml),...............);
> parser.parse(memBuf);
>
> > -----Original Message-----
> > From: Tasso Angelidis [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, August 02, 2001 10:13 AM
> > To: '[EMAIL PROTECTED]'
> > Subject: How To pass strings to the parser?
> >
> > Let's say I have a string...
> >
> > char *xml;
> >
> > xml = (char *) malloc(sizeof(char)*1000);
> >
> > strcpy(xml, "<?xml
> > version=\"1.0\"?><root><sometag>value</sometag></root>")
> >
> > Is it possible to to pass the string directly to the parser? If so how
> can
> > it be done?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]