Re: About character handler and attribute value

東原 正智 <[email protected]>
Newsgroups gmane.text.xml.expat.general
Message-ID <[email protected]>
Thank you.
I rewrite as follows.It worked.

void char_handle(void *userdata,const XML_char *s,int len)
{
for(int i=0;i<len;i++){
putchar(*s);
*s++;
}

I will set in this C program to C++ program.
I want to use array to put "putchar(*s)".
But becasues of const attribute,it cannot deal with this .
Please someone help me.
 
>>Hi, I have two questions.
>> 1. Can expat get attribute value ?
>> 2. I write C program as folows.
>> but why on the first line of first cahracter data it cut root open
>> tag(<biblio>).
>> 
>> (program)
>> ....
>> void char_handle(void *userdata,const XML_char *s,int len)
>> {
>> printf("[CHARACTERDATA] %s\n",s)
>> }
>> 
> 
> Using printf here is the problem.  const XML_char *s is not a null
> terminated string, it's a pointer into an underlying buffer.  int len
> tells you how many characters there are.  The text you want is 
> from s to
> s+len.  In the example you've given you could use a loop and 
> putchar to
> output it.
> 
> Jez
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.