Re: [xml] Is there any socket support?



On Tue, Mar 20, 2001 at 09:15:08PM -0600, stan boehm philips com wrote:
I have been trying to use  "xmlCreatePushParserCtxt" and
"xmlParseChunk"  to read from a socket stream.   After my code reads
approximately 1000 docs from the stream anywhere in size form
100 to 7000 bytes it always fails with parse error 4, 5 etc.

There must be a better way.  I have been listening in on your 
discussions for about 2 months, but have not seen anything
discussed related to reading from streams, or I missed it if it was.
Once I thought I saw something related, but now I can not find it.

All the functions I found for reading from files seemed to be limited
to one file, after which the file is  closed by  libxml.   Of course I
want my socket to remain open.  

I am using   libxml2-2.2.3.


Has anyone out there been down this road ?

I would appreciate any help or insight.

  I assume you have read the associated page, there is an
example precisely avoiding the close of a file descriptor.
  http://xmlsoft.org/xmlio.html

  Check the possible error conditions stored in the context on return
of xmlParseChunk() .
  What sounds strange is that you say
    "After my code reads approximately 1000 docs"
A parser context is supposed to handle one doc. So I'm a bit confused,
if you have a series of document passed along a single descriptor, it's
safer to have one context per doc, this may be the problem you're seeing
one of them is not well-formed and hence the parser refuses to proceed
further. You can also reset the error condition in the context and try
to do further processing but there is no guarantee that you stopped at
a document boundary and this is not very clean from an XML perspective.
  I would suggest to upgrade to some of the 2.3 series anyways,
because bugs have been fixed.

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




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