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

Re: [xml] End of document with push parser



Quoting Daniel Veillard <veillard redhat com>:

> On Tue, Aug 30, 2005 at 01:52:00PM +0200, Jérôme Marant wrote:
> > Hi,
> >
> > I'm writing a small server which receives requests from
> > a TCP stream in XML and I do use a push parser for
> > this (xmlParseChunk).
>
>   The program who push the data must provide the information about the
> end of the data to the parser. You cannot guess that from the parser state
> nor the XML data, that information must come from some context outside the
> document. If you don't have that inforamtion availbale in your system you
> are building it's a serious design flaw, basically it was designed without
> understanding XML.

Well, I'm certainly not an XML expert, but here is what I've read from
the specs:

-----------

[1]   	document	   ::=   	prolog element Misc*

 	Misc	   ::=   	Comment | PI | S

      [Definition: There is exactly one element, called the root, or document
element, no part of which appears in the content of any other element.] For all
other elements, if the start-tag is in the content of another element, the
end-tag is in the content of the same element. More simply stated, the
elements, delimited by start- and end-tags, nest properly within each other.

-----------

So, if there is exactly one root element and if the client does not send
any Misc, I guess that detecting the end of the root element should
indicate that I received the whole request, right? Would redefining
endElementSAXFunc for such a purpose do the trick?
Or, what am I not understanding?

Thanks.

--
Jérôme Marant



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