Re: [xml] Parsing problem



On 23.07.06 15:31:10, Ola Bodin wrote:
xmlDocPtr     doc;
xmlChar     *text;
int         size;
...
xmlDocDumpMemory(doc, &text, &size);

this is then sent over a socket an is parsed by the client with the
following conde:

char *str;
xmlDocPtr doc;
...
doc = xmlParseDoc((const xmlChar*)str);

Did you try to use xmlParseDoc directly on the server?

Entity: line 2: parser error : Specification mandate value for attribute
node
<xmlSend><test node/></xmlSend>

Where the '^' is pointing to the  '/' in <test node/>.
I have tried to find out what the message means on the web site but with out
any lyck.

Of course, because the error is that the XML contained in the char* is
not valid. You cannot have a xml node with a name containing
underscores. Thus "<test node/>" is parsed as XML node with the name
"test" and an attribute named "node", however it has no value and this
is also forbidden by XML - attributes need to have a value.

So either the construction of your DOM is wrong (in which case libxml2
should've complained already upon serialization, I think) or something
goes wrong during the transport over the wire.

To exclude the first possibility I'd suggest to include some testing
code inside the server app that takes the content of *text and tries to
parse it via xmlParseDoc.

Andreas

-- 
You learn to write as if to someone else because NEXT YEAR YOU WILL BE
"SOMEONE ELSE."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]