logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Cannot parse simple xml: msg#00014

Subject: Re: Cannot parse simple xml
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@xxxxxxxxxxxx
> To: Golibasku; expat-discuss@xxxxxxxxxxxx
> 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";


<Prev in Thread] Current Thread [Next in Thread>