logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Error parsing XML with DOMParser: msg#00028

Subject: Error parsing XML with DOMParser
I'm receiving an XML document over a TCP socket, I then instantiate an 
instance of DOMParser and attempt to parse the data.  I get the identical 
exception when using Xerces-J as well.   Here's the exception:

org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x0) was 
found in markup after the end of the element content.
        at 
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1213)
        at 
org.apache.xerces.framework.XMLDocumentScanner.reportFatalXMLError(XMLDocumentScanner.java:588)
        at 
org.apache.xerces.framework.XMLDocumentScanner$TrailingMiscDispatcher.dispatch(XMLDocumentScanner.java:1461)
        at 
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
        at 
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)

Here's the relevant snippet(s) of source (there is code to write out the 
socket, just not here):

Socket socket = new Socket( hostIP, hostPort );
OutputStream outStream = socket.getOutputStream();
InputStream inStream = socket.getInputStream();
DataInputStream dataInStream = new DataInputStream( inStream );
byte[] inByteArray  = new byte[ 2048 ];
int length =  dataInStream.read( inByteArray );
InputStream byteData  =  new ByteArrayInputStream( inByteArray );

try 
{
       DOMParser dp = new DOMParser();
       dp.parse( new InputSource( byteData ));
       Document doc = dp.getDocument();
}
catch ( Exception e )
{
        e.printStackTrace();
        System.exit( 1 );
}

Is there a different way to do this?  I even tried creating a new String 
based on the length read from the socket, minus one.  The parser then saw 
that the final angle bracket of my root element was missing, so it doesn't 
seem to be an encoding issue.

Any help would be appreciated.
Jeff


Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
encryption.gpg....    ietf.rfc822/199...    freebsd.devel.i...    lang.haskell.li...    mail.squirrelma...    web.zope.plone....    yellowdog.gener...    text.xml.xalan....    recreation.phot...    kde.devel.educa...    hardware.bus.ca...    printing.ghosts...    voip.peering/20...    assembly/2006-0...    org.user-groups...    culture.interne...    network.i2p/200...    boot-loaders.ya...    xfree86.render/...    qnx.openqnx.dev...    jakarta.velocit...    user-groups.pal...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe