xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Njaka, Chikeobi" <CNj...@ndsamericas.com>
Subject RE: Parsing XML Streams
Date Thu, 01 Feb 2001 21:47:19 GMT
Dane,
 
Thanks. Didn't work. Still blocks after startDocument method.

-----Original Message-----
From: Dane Foster [mailto:dfoster@equitytg.com]
Sent: Thursday, February 01, 2001 10:59 AM
To: general@xml.apache.org
Subject: Re: Parsing XML Streams


Buffer the stream.
 
ex: parser.parse( new InputSource( new BufferedInputStream(
socket.getInputStream() ) ) );
 
Dane Foster
Equity Technology Group, Inc
http://www.equitytg.com <http://www.equitytg.com> .


----- Original Message ----- 
From: Njaka,  <mailto:CNjaka@ndsamericas.com> Chikeobi 
To: 'general@xml.apache.org' <mailto:'general@xml.apache.org'>  
Sent: Thursday, February 01, 2001 1:24 PM
Subject: Parsing XML Streams


Hi!, 
I have an application that produces data in XML format. Clients can connect
using TCP/IP and once connected, the DTD is sent, followed by well formed
and valid (except for the last closing tag) XML data as it is generated. I
have tried using the following code:

*************************************************************************** 
    try { 
      Parser parser; 
      // 
      SAXParserFactory spf = SAXParserFactory.newInstance(); 
      String validation =
System.getProperty("javax.xml.parsers.validation","true"); 
      if (validation.equalsIgnoreCase("true")) spf.setValidating(true); 
      // 
      SAXParser sp = spf.newSAXParser(); 
      parser = sp.getParser(); 
      // 
      XMLParser xmlParser = new XMLParser(this.xmlData); 
      parser.setDocumentHandler(xmlParser); 
      parser.setErrorHandler(xmlParser); 
      // 
      parser.parse(new InputSource(socket.getInputStream())); 
    } catch (SAXParseException e) { 
      System.out.println("***ERROR*** Parsing Error " + " , line " +
e.getLineNumber() + 
      ", uri " + e.getSystemId()); 
      System.out.println("  " + e.getMessage()); 
      System.exit(1); 
    } catch (SAXException se) { 
      Exception x = se; 
      if (se.getException() != null) { 
        x = se.getException(); 
        x.printStackTrace(); 
      } 
      System.exit(1); 
    } catch (Throwable t) { 
      t.printStackTrace(); 
      System.exit(1); 
    } 

*************************************************************************** 

While the startDocument event is triggered, nothing else happens. I have
checked and indeed, the data stream is coming through.

Help anyone? 


Chikeobi Otuokere Njaka 
cnjaka@ndsamericas.com 


Mime
View raw message