[Expat-discuss] Cannot parse simple xml

Golibasku ceo at absoft-net.com
Wed Aug 11 19:37:25 CEST 2004


After separating the line. The error message is "not well-formed (invalid
token) at line 5

the document is:

<?xml version="1.0" encoding="ISO-8859-1"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>


> -----Original Message-----
> From: expat-discuss-bounces at libexpat.org
> To: Golibasku; expat-discuss at libexpat.org
> Subject: Re: [Expat-discuss] Cannot parse simple xml
>
>
> On Wednesday 11 August 2004 12:27 pm, Golibasku wrote:
>  > 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 ??
>  >
>  > ----------xml document------------------
>  > <?xml version=\"1.0\"?>
>
> The backslashes on this line are not allowed.
>

They wouldn't be in the document as per his source code. They tell the
compiler that the '"' are meant as part of the string not to delimit the
string. He has no new lines in the string either so line one will be the
entire document. You might try putting some in - maybe there's a
non-printing
character somewhere (did you copy and paste the string from somewhere)? You
might get a better idea where to look.

char *buf =  "<?xml version=\"1.0\"?>\n"
"<note> \n<to> Tove </to>\n"
"<from> Jani </from>\n"
"<heading> Reminder </heading>\n"
"<body> Don't forget me this weekend </body>\n"
"</note>\n";




More information about the Expat-discuss mailing list