Hi Malathi,

>From this piece of code and the error message in your last email, it still 
looks like the problem has to do with the InputStream or Reader that 
you're using.  Unfortunately, this piece of code doesn't really help debug 
the problem, since it doesn't show how the Reader is initialized or the 
contents of the XML file that is being read.

You'll get the most help from people on this list if you post a simple, 
stand-alone test case that reproduces the problem.  Provide a simple XML 
file, and a single class with a main method that can be run to show the 
error being generated by the Xerces parser.  Frequently, in trying to 
build such a test case, you'll discover for yourself what the problem is.

Cheers,
-- 
Peter McCracken
XML Parser Development
IBM Toronto Lab
Email: [EMAIL PROTECTED]

"Malathi Somu" <[EMAIL PROTECTED]> wrote on 29/11/2006 01:35:38 
PM:

> HI 
> I posted question earlier. Thanks Peter for answering...
> Here is the details of the code when it happens...
> While the code try to read the document it calls this XCBL class given 
below.
> 
> Any help is appreciated.
> 
> thanks.
> 
> public class XCBL extends TPCXXmlWrapper {
> public XCBL(Reader reader) throws java.io.IOException
>     {
>         super(reader);
>         this.doc = getDocument();
>         this.root = getRoot();
>     }
> }
> 
> ******************* TPCXXMLWrapper class *******************
> 
> public class TPCXXmlWrapper implements java.io.Serializable, 
> Cloneable, XMLProducer {
> 
>     public TPCXXmlWrapper(Reader reader) throws IOException
>     {
>         this(loadFrom(reader));
>     }
> 
>     public static Document loadFrom(Reader reader) throws IOException
>     {
>         return loadFrom(new InputSource(reader));
>     }
> 
>     public static Document loadFrom(InputSource source) throws 
IOException
>     {
>         final String METHOD_NAME = "loadFrom";
> 
>         try
>         {
>             org.apache.xerces.parsers.DOMParser parser = new org.
> apache.xerces.parsers.DOMParser();
>             parser.parse(source);
>             Document doc = parser.getDocument();
>             return doc;
>         } catch (Exception se) {
> 
>             if (source.getCharacterStream() != null) {
>                 String aLine = "";
>                 StringBuffer stringbuffer = new StringBuffer();
>                 try {
>                         java.io.BufferedReader buf = new java.io.
> BufferedReader(source.getCharacterStream());
>                         if (buf != null) {
>                         while ((aLine = buf.readLine()) != null) {
>                             stringbuffer.append(aLine);
>                         }
>                     }
>                 } catch (Exception e) {
>                     stringbuffer.append("(Failed to read lines after
> this point due to exception: " + e.toString() + ")");
>                 }
> 
>                 TPCXLogger.log(CLASS_NAME, METHOD_NAME, TPCXLogger.
> PRIORITY_ERROR, "Failed to parse given InputSource.  Exception: [" +
> se.getMessage() + "]", se); // this is where we log exception and 
> getting message.
> 
>                }
>             else {
>                 if (source.getByteStream() != null) {
>                     TPCXLogger.log(CLASS_NAME, METHOD_NAME, 
> TPCXLogger.PRIORITY_ERROR, "Failed to parse given InputSource. 
> Returning NULL.  Stream is available for content document.", se);
>                 }
>                 else {
>                     TPCXLogger.log(CLASS_NAME, METHOD_NAME, 
> TPCXLogger.PRIORITY_ERROR, "Failed to parse given InputSource. 
> Returning NULL.  No reader nor stream available for content document.", 
se);
>                 }
>             }
>             return null;
>         }
>     }
> 
> 
> 
> 
> Notice: This transmission is for the sole use of the intended 
> recipient(s) and may contain information that is confidential and/or
> privileged.
> If you are not the intended recipient, please delete this 
> transmission and any attachments and notify the sender by return 
> email immediately.
> Any unauthorized review, use, disclosure or distribution is prohibited.

Reply via email to