You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Michael Robkin <mr...@hbsrx.com> on 2001/01/30 21:17:43 UTC

dom parser

  I want to use a dom parser with data coming in from a socket. Is this
possible?


   i can only get it to work if the sending program sends only 1 message and
then closes the socket.



     Michael Robkin


Re: dom parser

Posted by Andy Clark <an...@apache.org>.
Michael Reynolds wrote:
> Look at the class BinInputStream.
> http://xml.apache.org/xerces-c/apiDocs/class_BinInputStream.html  As long as

Since this is the Java mailing list, you may find the socket sample
that is part of Xerces2 more helpful. In particular, look at the
WrappedInputStream and WrappedOutputStream. You can get the code
from the alpha release of Xerces2 in the distribution directory or
straight from CVS -- it's in the java/samples/socket dir.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

Re: dom parser

Posted by Dane Foster <df...@equitytg.com>.
I just joined the mailing list so I have no idea what the previous post was.
Therefore, I'm shooting from the hip (keyboard).  Try this.

BufferedInputStream iStream = new BufferedInputStream(
socket.getInputStream() );
ByteArrayOutputStream byteStream = new ByteArrayOutputStream( 1024 );
byte[] bytes = new byte[ 1024 ];
int eof = iStream.read( bytes );
while( -1 != eof )
{
    byteStream.write( bytes, 0, eof );
    eof = iStream.read( bytes );
}
iStream.close();
byteStream.flush();
byteStream.close();

parser.parse( new InputSource( new ByteArrayInputStream(
byteStream.toByteArray() ) ) ) );


Dane Foster
MIS Director
Equity Technology Group, Inc
http://www.equitytg.com.
954.360.9800
----- Original Message -----
From: "Michael Robkin" <mr...@hbsrx.com>
To: <xe...@xml.apache.org>
Sent: Thursday, February 01, 2001 3:03 PM
Subject: RE: dom parser


How would the input socket know when the input stream is done?

-----Original Message-----
From: Michael Reynolds [mailto:mreynold@interwoven.com]
Sent: Tuesday, January 30, 2001 4:09 PM
To: xerces-j-dev@xml.apache.org
Subject: RE: dom parser


Michael,

Look at the class BinInputStream.
http://xml.apache.org/xerces-c/apiDocs/class_BinInputStream.html  As long as
you write the input of the socket to something XMLByte and then call the
constructor for the class and then pass the object to the parser you should
be fine.  But you have to pass the XML Document within the stream as a
complete document.

Mike


-----Original Message-----
From: Michael Robkin [mailto:mrobkin@hbsrx.com]
Sent: Tuesday, January 30, 2001 12:18 PM
To: xerces-j-dev@xml.apache.org
Subject: dom parser


  I want to use a dom parser with data coming in from a socket. Is this
possible?


   i can only get it to work if the sending program sends only 1 message and
then closes the socket.



     Michael Robkin


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org




Re: dom parser

Posted by Andy Clark <an...@apache.org>.
Michael Robkin wrote:
> How would the input socket know when the input stream is done?

The wrapped input/output streams handle this for you. It
enables you to create a stream within a stream, if you
catch my drift. Closing the wrapped stream does not close
the stream in which it was embedded. And the code of the
sample is pretty straightforward. (It should be; I wrote
it. ;)

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

RE: dom parser

Posted by Michael Robkin <mr...@hbsrx.com>.
How would the input socket know when the input stream is done?

-----Original Message-----
From: Michael Reynolds [mailto:mreynold@interwoven.com]
Sent: Tuesday, January 30, 2001 4:09 PM
To: xerces-j-dev@xml.apache.org
Subject: RE: dom parser


Michael,

Look at the class BinInputStream.
http://xml.apache.org/xerces-c/apiDocs/class_BinInputStream.html  As long as
you write the input of the socket to something XMLByte and then call the
constructor for the class and then pass the object to the parser you should
be fine.  But you have to pass the XML Document within the stream as a
complete document.

Mike


-----Original Message-----
From: Michael Robkin [mailto:mrobkin@hbsrx.com]
Sent: Tuesday, January 30, 2001 12:18 PM
To: xerces-j-dev@xml.apache.org
Subject: dom parser


  I want to use a dom parser with data coming in from a socket. Is this
possible?


   i can only get it to work if the sending program sends only 1 message and
then closes the socket.



     Michael Robkin


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


RE: dom parser

Posted by Michael Reynolds <mr...@interwoven.com>.
Michael,

Look at the class BinInputStream.
http://xml.apache.org/xerces-c/apiDocs/class_BinInputStream.html  As long as
you write the input of the socket to something XMLByte and then call the
constructor for the class and then pass the object to the parser you should
be fine.  But you have to pass the XML Document within the stream as a
complete document.

Mike


-----Original Message-----
From: Michael Robkin [mailto:mrobkin@hbsrx.com]
Sent: Tuesday, January 30, 2001 12:18 PM
To: xerces-j-dev@xml.apache.org
Subject: dom parser


  I want to use a dom parser with data coming in from a socket. Is this
possible?


   i can only get it to work if the sending program sends only 1 message and
then closes the socket.



     Michael Robkin


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org