You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Philippe Rochat <Ph...@epfl.ch> on 2001/03/08 00:51:12 UTC

Some new classes of my own

Hi,

I've written these two classes (see attachement). The purpose is to have the
ability to pass to a DOM contructor a descriptor (like a socket) from which he
could build himself.
In my case I had an application (Tamino from software AG) "answering" xml
documents to some specific queries (i.e. URLInputDesciptor wasn't enough for
me). In my case, I'm opening the socket, writing the query on it, reading some
bytes for skipping the HTTP header, and then I just
pass the descriptor as argument for building a new DescriptorInputSource ... and
everything comes out in a DOM Document.

I presume that for larger documents, some improvement would be required to check
availability of the stream, but it was ok for my needs like that for now.

(Juste tell me if you are going to incorporate this into distrib thus I don't
have to maintain my "customized" version of xerces on my side.)

Here is an example (demonstrate how easy it is, once you have a socket and you
are sure there is xml to be read on it, but that works fine when you reading
result of an HTTP request after skipping HTTP header):

// Buid a new DOM document from a descriptor (like socket)
//         desc: descriptor
// Throws: any subsystem exception !
gwmsg_DOM_Document::gwmsg_DOM_Document(const int desc) {
  DescriptorInputSource in(desc);
  gwmsg_DOMParser *parser = new gwmsg_DOMParser();
  try {
    parser->parse(in);
  } catch(...) {
    throw;
  }
  doc = parser->getDocument();
}

_____________________________________________________________________
Philippe Rochat, (Yahoo-id:philipperochat)	EPFL   DI-LBD
Database Laboratory 					CH-1015 LAUSANNE
Swiss Federal Institute of Technology (EPFL) 	tel:++41 21 693 52 53
Beep-EPFL: 181 4644					fax:++41 21 693 51 95
Private: Grammont, 9 1007 LAUSANNE 			tel:++41 21 617 03 05
mailto:Philippe.Rochat@epfl.ch			GSM:++41 76 384 52 53