For Programmers: Free Programming Magazines  


Home > Archive > Java Help > April 2007 > StAX (SJSXP) XMLInputFactory blocking when creating reader









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author StAX (SJSXP) XMLInputFactory blocking when creating reader
andek

2007-04-19, 7:08 pm

Hi,

I'm trying to use StAX (SJSXP implementation) on a socket inputstream.
When I try to use the input factory to create a XMLStreamReader (or
XMLEventReader), it blocks. Skeleton code:

ServerSocket s = new ServerSocket(1234);
Socket sock = s.accept(); // accepts fine
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader =
factory.createXMLStreamReader(sock.getInputStream()); // blocks here

I'd appreciate any help, or thoughts.
(If this should go in another group, please let me know too)

Thanks,
Andrew

andek

2007-04-20, 10:07 pm

Should this help anyone..
When setting up the reader it'll first try to read the xml declaration
before handing it off to the application.
Once I sent <?xml version="1.0" encoding="UTF-8"?> over the socket, it
worked.

Here's the call stack up to the read:
XMLEntityManager$RewindableInputStream.read() line: 1894
XMLEntityManager.startEntity(String, XMLInputSource, boolean, boolean)
line: 773
XMLEntityManager.startDocumentEntity(XMLInputSource) line: 697
XMLNSDocumentScannerImpl(XMLDocumentScan
nerImpl).setInputSource(XMLInputSource)
line: 300
XMLReaderImpl.setInputSource(XMLInputSource) line: 193
XMLReaderImpl.<init>(XMLInputSource, PropertyManager) line: 179
ZephyrParserFactory.getXMLStreamReaderImpl(XMLInputSource) line: 270
ZephyrParserFactory.createXMLStreamReader(String, InputStream, String)
line: 161
ZephyrParserFactory.createXMLStreamReader(InputStream) line: 144

-Andrew

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com