[Expat-discuss] Cannot parse simple xml

Jez Higgins jez at jezuk.co.uk
Wed Aug 11 20:10:59 CEST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Hello,
>     I try to parse the following document. But it always tell me "not
> well-formed (invalid token) at line 1". What is the reason ??
> 

>  CHAR buf[100];
>  strcpy(buf, "<?xml version=\"1.0\"?> <note> <to> Tove </to> <from>
>  Jani
> </from> <heading> Reminder </heading> <body> Don't forget me this
> weekend </body> </note>");

Looks to me like your buffer is too small.  Your XML doc is over 100 
chars long, so it's just luck the you haven't smashed the stack with 
that strcpy.  

Try increasing the size of your buffer and seeing what happens.

Jez
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)

iD8DBQFBGmEzd5Jqiw9+jCsRAp9uAJ4l0BRHg2Jm3dELGuJTCN8thbICzQCeOYzO
H8byzPBbehzbLU4WrfoKWRA=
=cTUS
-----END PGP SIGNATURE-----


More information about the Expat-discuss mailing list