Re: String Index out bound exception : 34



Sanjeev wrote:
dear gurus

i m reading XML file in the form of string.

below is the code.

private void parseDocument(String receivedMessage) {
//get a factory
SAXParserFactory spf = SAXParserFactory.newInstance();
try {
//get a new instance of parser
SAXParser sp = spf.newSAXParser();

//parse the file and also register this class for call backs
sp.parse(new InputSource(new
ByteArrayInputStream(receivedMessage.getBytes())), this);

}catch(SAXException se) {
}catch(ParserConfigurationException pce) {
}catch (IOException ie) {
}
}

In this code i m getting error on line started with "sp.parse(..."

could any one help why i m getting this error..

Please do not use txtspeak.

Where do you get the XML input? Did you create it beforehand?

You're most likely getting an error (*what* error? Please copy-and-paste it into your post in future) because the XML document is either not valid or not well-formed.

You ignore every exception, so of course you lack the information necessary to debug the code. Put logging statements, or at the very, very least System.err.println() calls (never System.out for this purpose) into your catch blocks that tell you about the exception.

--
Lew
.



Relevant Pages

  • Re: problem with XML DOM load command
    ... with invalid XML and I'm getting suspicious that something in a QFE ... has busted MSXML and its exception processing. ... © 2003 Microsoft Corporation. ... >> So this exception is on your main thread where you're doing the load. ...
    (microsoft.public.windowsce.embedded.vc)
  • XML Verarbeitung
    ... Ich möchte eine XML Datei in ein DataSet einlesen und in einem DataGrid ... An unhandled exception occurred during the execution of the ... Please review the stack trace for more information about ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: writeXML(fullFilePath) DOESNT Write
    ... I also wonder if you get an exception on attempt to load saved file... ... > The following hardware and drivers are not supported in the Emulator: ... > File system drivers, which include file allocation table, compact ... XML into the dataset from the path noted in the code I've provided (using ...
    (microsoft.public.dotnet.framework.compactframework)
  • Client Error When Consuming Web Method
    ... write directly to the XMLDocument. ... (Originally the XML was passed as a string. ... Server was unable to read ... First, is this actually a server side exception, or will the proxy code ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Can I change to field type in an XML schema automatically?
    ... You should catch this exception and print out error messages from error ... >>>I have built an XML file using the DataSet.writeXML method and it creates ... >>> Now the issue I have is getting the Double into a sqlce database. ...
    (microsoft.public.dotnet.framework.compactframework)