Sax character method cutting elements

Hi everyone.
Here is my problem, sometimes the character method of Sax parser doesn't give me entire elements back.
I found these but cannot get it working:
Also, be really careful with what you get back from the characters method of the handler.
You can't count on the method to return entire element values -- my installation returns the value in one or more chunks.
The parser reads data in buffer's worth (in my case 2048 byte chuncks) and if it reaches the end of a buffer during the characters method.
It won't tell you -- you just get partial data, which you have to "string together" (StringBuffer.append()) until end element is reached.
The parser doesn't do this for you!
Actually here is what my Character method is giving me :
LEMONDE94-002500-19940319 ||  Nous nous conduirons comme de bons Europ�ens , affirme M. Pellat ,  mais nous serons d�sormais moins tir�s par les programmes de l' Agence , compl�te M. Levi .Nos engagements vis-�-vis de l' ESA repr�sentent 55,3% de nos autorisations de programme .Ce n' est pas un secret , nous n' irons pas plus loin .Ce n' est pas un mouvement anti-ESA , mais cela nous permettra , � partir de 1997 , "avec la baisse des besoins pour le d�veloppement du lanceur Ariane-5 , de d�gager des moyens pour l'avenir et nos programmes nationaux " .
LEMONDE94-002500-19940319 || "avec la baisse des besoins pour le d�veloppement du lanceur Ariane-5 , de d�gager des moyens pour l' avenir et nos programmes nationaux " .The first sentence is ok, but I only get the end of the second.
Here is my Character method :
public synchronized void characters(char[] ch, int start, int end) throws SAXException {
                if(localNameBuffer.equals(tagEnonce)==true){
                     contents[indexArr][1]=new String(ch, start, end);
         }Thanks for your help.
FeezDev

Hi,
I seem to be having the same problem. I'm relatively new to SAX, but I've implemented the parser to retrieve data and for some of the data I'm retrieving it is incomplete. If I'm understanding the above post correctly, and although this behaviour is documented it is still my job to correct this behaviour (not that I'm complaining or anything)?
Looking at the code posted by FeezDev I'm not completely sure how to catch this case or exactly what is the role of the characters method. Could anyone please shed some light. The code I'm using is as follows...
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class XMLParser extends DefaultHandler implements Clearable{
          //member objects
     private String tempValue;
     private Corrective tempCorrective;
     private List corrective;
     private File xmlFile;
      *      CONSTRUCTOR
     public XMLParser(){
          corrective=new ArrayList();
     public XMLParser(File f){
               //set file to parse
          this.setFile(f);
               //new arrayList instance
          corrective=new ArrayList();
      *      PARSE DOCUMENT
     public Runnable parseDocument(){
               //get a the sax parse factory
          SAXParserFactory parseFactory=SAXParserFactory.newInstance();
          try{
                    //obtain a new parser instance
               SAXParser parser=parseFactory.newSAXParser();
                    //parse the xml file and register this class for call backs
               parser.parse(xmlFile.getName(),this);
          }catch(SAXException se){
               se.printStackTrace();
          }catch(ParserConfigurationException pce){
               pce.printStackTrace();
          }catch(IOException ioe){
               ioe.printStackTrace();
          return null;
      *      START ELEMENT
     public void startElement(String uri,String localName,String qName,Attributes attribute)throws SAXException{
               //reset tempValue
          tempValue="";
               //if open element is encountered
          if(qName.equalsIgnoreCase("corrective")){
                    //create a new corrective action instance
               tempCorrective=new Corrective();
               tempCorrective.setID(attribute.getValue("id"));
          }else if(qName.equalsIgnoreCase("action-ref")){
               tempCorrective.appendIdref(attribute.getValue("idref"));
      *      CHARACTERS
     public void characters(char[] ch,int start,int length)throws SAXException{
          tempValue=new String(ch,start,length);
      *      END ELEMENT
     public void endElement(String uri,String localName,String qName)throws SAXException{
               //if corrective actions is encountered again
          if(qName.equalsIgnoreCase("corrective")){
                    //add the retrieve object to the list
               correctiveActions.add(tempCorrective);               
          }else if(qName.equalsIgnoreCase("text")){
                    //set the value of the text element
               tempCorrective.setText(tempValue);
     }Thanks in advance!

Similar Messages

  • Org.xml.sax.SAXParseException: Document root element "taglib", must match D

    hi
    using tomcat 4
    and jdf1.5
    i am getting bellow error
    org.xml.sax.SAXParseException: Document root element "taglib", must match DOCTYPE root "null".

    Check your web.xml once again.

  • Org.xml.sax.SAXParseException: Document root element is missing.

    Hi,
    I am trying to get the portal login id from a weblogic server based application from iplaet portal server.
    I get this follwoing error
    org.xml.sax.SAXParseException: Document root element is missing.
    at com.sun.xml.parser.Parser.fatal(Parser.java:2817)
    at com.sun.xml.parser.Parser.fatal(Parser.java:2805)
    at com.sun.xml.parser.Parser.parseInternal(Parser.java:493)
    at com.sun.xml.parser.Parser.parse(Parser.java:284)
    at com.sun.xml.tree.XmlDocument.createXmlDocument(XmlDocument.java:226)
    at com.iplanet.portalserver.util.XMLParser.<init>(XMLParser.java:70)
    at com.iplanet.portalserver.naming.share.NamingResponseParser.<init>(NamingResponseParser.java:33)
    at com.iplanet.portalserver.naming.share.NamingResponse.parseXML(NamingResponse.java:74)
    at com.iplanet.portalserver.naming.WebtopNaming.updateNamingTable(WebtopNaming.java:174)
    at com.iplanet.portalserver.naming.WebtopNaming.getNamingProfile(WebtopNaming.java:155)
    at com.iplanet.portalserver.naming.WebtopNaming.getServiceURL(WebtopNaming.java:57)
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:534)
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:520)
    at com.iplanet.portalserver.session.Session.getSession(Session.java:414)
    at jsp_servlet.__eatonPortalLogin._jspService(__eatonPortalLogin.java:155)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:462)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5517)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3156)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2506)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)
    <May 19, 2004 9:01:12 AM EDT> <Error> <HTTP> <101017> <[ServletContext(id=4873279,name=ematrix,context-path=/ematrix)] Root cause of ServletException
    com.iplanet.portalserver.session.SessionException
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:539)
    at com.iplanet.portalserver.session.Session.getSessionServiceURL(Session.java:520)
    at com.iplanet.portalserver.session.Session.getSession(Session.java:414)
    at jsp_servlet.__eatonPortalLogin._jspService(__eatonPortalLogin.java:155)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:462)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:306)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:5517)
    at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:685)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3156)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2506)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:234)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:210)
    Any help/pointers will be appreciated.
    Ashish

    Just for anyone else who hits this problem: I encountered the same issue with an XML document that XMLSpy claims is quite well formed. I opened the document in a hex editor, and there at the from was a three-byte byte order marker - the marker that I believe the UTF-8 standard says is optional. I removed these three bytes, and the file was parsed correctly.
    In this case, the XML file was created using a Microsft DOM (save).
    My solution is to make the java parser - as I use it - a tad more robust: Open the file and create an input stream - a pushback input stream. Read the first three bytes; if they are NOT a BOM, then push those bytes back. Now - in any case - give the stream to the parser to read.
    try {
    // Open file for reading.
    f = new File(path);
    FileInputStream fis = new FileInputStream(f);
    PushbackInputStream pis = new PushbackInputStream(fis);
    byte[] buf = new byte[3];
    pis.read(buf, 0, 3);
    if (! (buf[0] == 0x00EF) && (buf[1] == 0x00BB) && (buf[2] == 0x00BF) ) {
         pis.unread(buf, 0, 3);
    builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    doc = builder.parse(pis);
    catch (Exception x) {
         x.printStackTrace();
    }

  • BiizTalk 2013 and EDI Message Invalid character in data element

    Hi:
    Background: I have a Vendor sending us EDI
    856 (Advance Shipping Notice). We are using EDI X12 and BizTalk 2013. In the Parties Agreement we use ISA11 = U-US EDI Community of ASC X12. The vendor is sending 'U' in ISA11.
    Error:
    At the beginning of EDI Schema import, during EDI audit, we get the following error messages, repeated a few time.
    Error: 1 (Field level error)
                SegmentID: LIN
                Position in TS: 18
                Data Element ID: LIN09
                Position in Segment: 9
                Data Value:
                6:
    Invalid character in data element
    Error: 2 (Field level error)
                SegmentID: PID
                Position in TS: 20
                Data Element ID: PID05
                Position in Segment: 5
                Data Value:
                6:
    Invalid character in data element
    Root Cause: In all the error cases the data
    fields contain “Ü” (U with two dots above it). German character.
    Question: What is the best way to deal with
    the issue or replace “Ü” (U with two dots above it) characters?
    Looking forward to your reply.
    Regards, Toraj
    Toraj [email protected]

    I edited the source file and saved it as UTF-8. It seems, it resolved the issue.
    Very cool.
    Toraj
    Toraj [email protected]
    Glad that you have solved this issue by yourself, and thanks for sharing your solution to us.
    Best regards,
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • ITunes producer error 3000 character content of element "file_name" invalid. Can anyone help me out? This happens when i try and submit an epub file, i haven't had this before.

    Can anyone help me out? This happens when i try and submit an epub file, i haven't had this before. "iTunes producer error 3000 character content of element "file_name" invalid."
    This is the full message

    You really need to put your codes between the
    [\code] tags
    see http://forum.java.sun.com/features.jsp#Formatting
    for more infoCode tags might make it look a little better, but there's still too darn much code. We're volunteers, after all. It'd be a lot of work to review all of this stuff. Can you demonstrate your problem with something smaller? Learn out how to do a combo box with just a page or two and then appy that to your big problem. That's how I'd do it. - MOD

  • CORE3282: stdout: org.xml.sax.SAXParseException: Document root element

    I got an application running on Sun ONE Web Server 6.1SP5, during the application start, I got the following message. The application can run without any problem. I would like to know if there is any solution to avoid the PARSE error? Thanks a lot.
    [01/Aug/2006:11:42:09] info (21921):      CORE1116: Sun ONE Web Server 6.1SP5 B08/18/2005 02:17
    [01/Aug/2006:11:42:09] info (21923):      CORE5076: Using [Java HotSpot(TM) Server VM, Version 1.4.2_04] from [Sun Microsystems Inc.]
    [01/Aug/2006:11:42:09] info (21923):      WEB0100: Loading web module in virtual server [https-sunfire] at [myapp]
    [01/Aug/2006:11:42:09] info (21923):      WEB0100: Loading web module in virtual server [https-sunfire] at [search]
    [01/Aug/2006:11:42:13] info (21923):      CORE3282: stdout: PARSE error at line 6 column 19
    [01/Aug/2006:11:42:13] info (21923):      CORE3282: stdout: org.xml.sax.SAXParseException: Document root element "taglib", must match DOCTYPE root "null".
    [01/Aug/2006:11:42:13] info (21923):      WEB2798: [myapp] ServletContext.log(): Loading Spring root WebApplicationContext
    [01/Aug/2006:11:42:18] info (21923):      WEB2798: [myapp] ServletContext.log(): Loading WebApplicationContext for Spring FrameworkServlet 'action'
    [01/Aug/2006:11:42:18] info (21923):      HTTP3072: [LS ls1] http://sunfire:9999 ready to accept requests
    [01/Aug/2006:11:42:18] info (21923):      CORE3274: successful server startup

    That doesn't say much. Which is this xml file? and what have you given in the <!DOCTYPE > tag? Probably, that is the mistake...

  • What does this error means? "Line 20 column 57: character content of element "language" invalid; must be a string with length equal to 3 (actual length was 7) at XPath /package/book/metadata/languages/language" "

    Hi there.
    I am about to publish a book in English and Chinese.
    What does this error means?
    Line 20 column 57: character content of element "language" invalid; must be a string with length equal to 3 (actual length was 7) at XPath /package/book/metadata/languages/language"
    And where is line 20, column 57?
    Thanks folks!

    Go into iTunes Producer and select from the dropdown, don't type.
    cs
    iBooks Author Guide

  • Character Panel in Elements 10?

    How do you find/access the character panel in Elements 10?  It's not an option in the Window menu in the menu bar like everywhere says it should....
    Thanks for the help!

    On the other hand, if you do find it -- you'll be making history!
    Ken

  • Invalid character in data element-Biztalk 2013

    I am using Biztalk 2013, i want to process a file received from partner EDI To XML(843). I received following file as below:-
    REF~QU~N //I received QU value in received file for REF01 and this value is mentioned in collection for REF01, still biztalk is generating following error
    Note:-I even change the Base data type to xs:string from X12_AN
    Error: 1 (Field level error)
        SegmentID: REF
        Position in TS: 5
        Data Element ID: REF01
        Position in Segment: 1
        Data Value:
        6: Invalid character in data element
    Secondly almost same error is is N1 loop
    N1~S8~PUBLIC SERV N C~29~42222//i received this value in N102
    Note:-I even change the Base data type to xs:string
    Error: 3 (Field level error)
        SegmentID: N1
        Position in TS: 22
        Data Element ID: N102
        Position in Segment: 2
        Data Value:
        6:Invalid character in data element
    Help me to solve this issue.it's urgent
    Thanks in advance

    Hi Gag,
    1.Create a new custom receive pipeline
    2.Add the XmlDisassembler to the pipeline and configure it to your need.
    3.Add the FixEncodingComponent to the pipeline in the Decode stage, so that it is run before the XmlDisassembler.
    4.Set the Encoding parameter of the component in the Property Explorer to the encoding you want to use. To make this easier, the component implements a custom
     UITypeEditor that pops up a list of all the encodings supported by the .NET framework:
    For encoding Component you can visit
    http://winterdom.com/2006/01/fixmessageencodingcustompipelinecomponentsample
    Thanks
    Abhishek

  • Invalid character in data element

    I'm pretty new to BizTalk and need help with this suspended instance. We're getting 875 PO from the customer via EDI BizTalk 2009 X12.
    Here is EDI:
    N1*BT*SOUTHEAST COMPANY*9*6666666660000
    N3*3261 STREET WAY
    N4*CITY*TX*ZIP
    N1*ST*ORANGES OF STATE*9*6777777770100
    N3*18000 N.E. 6th Ave.
    N4*CITY*TX*ZIP
    G68*10*CA*12.21*007333333333*PI*385
    G69*TASTY CREAM
    The errors:
    Error: 1 (Field level error)
              SegmentID: N1
              Position in TS: 6
              Data Element ID: N102
              Position in Segment: 2
              Data Value:
              6: Invalid character in data element
    Error: 2 (Field level error)
              SegmentID: N3
              Position in TS: 7
              Data Element ID: N301
              Position in Segment: 1
              Data Value:
              6: Invalid character in data element
    Error: 3 (Field level error)
              SegmentID: G69
              Position in TS: 13
              Data Element ID: G6901
              Position in Segment: 1
              Data Value:
              6: Invalid characte
    As you can see I have 2 segments of N1 with bill-to and ship-to addresses. I don't see anything suspicious in any of  N1 or N3 or G69.
    I would really appreciate help!!
    akolons

    In your Agreement, is "Character set to be used" set to "Basic", "Extended" or "UTF8/Unicode"?
    Basic only allows capitalized letters fra A-Z.
    However, since you are also getting errors in your N1 segment, I'm not sure this is the case. I have a feeling that the problem has to do with spaces in your strings, can you try the following:
    - Remove all spaces from any of the texts in your document (example: SOUTHEAST COMPANY -> SOUTHEASTCOMPANY).
    - If the first step eliminates the error, make sure that your spaces has hex-value 20 (decimal 32) and that no spaces has been chosen in your Agreement for any of the characters in "Character set and separators".
    Morten la Cour

  • Cutting elements by alpha

    Hi.
    I'm trying to cut elements in a document that has transparency (in this case lines of rasterized text) so that each element becomes a separate layer.
    I was wondering if there is anything in photoshop scripting that could help me with this.
    Ideally it would be something like cutting chunks that have more than X transparent pixels between them.
    Though from my understanding those kinds of operations are only possible with Pixel Bender which is now defunct?

    Well, I've made some progress since I posted.
    My strategy is:
    1. Stroke the document to the required amount of distance.
    2. Select stroked pixels and convert selection to a path.
    3. Convert the path's subpaths to individual paths <--- Haven't figured out this stage yet.
    4. Select each individual path and cut from the original layer using this selection.

  • SAX XML NullPointerException in character() method

    I'm having issues when parsing my xml file. Everything works fine unless I am trying to push values into my parameters Vector.
    class SAXLoader extends DefaultHandler {
        private static String className, //name of the class for module in xml
                methodName,              //name of the method for the class
                path;                    //path to jar. should be in URI format
        private Vector params;      //parameters to the method
        private boolean isClassName,     //true if element begins className tag
                isMethodName,            //true if element begins methodName tag
                isParameter,             //true if element begins parameter tag
                isPath;                  //true if element begins path tag
        //=======================init()================================
        //opens XML file specified and parses it for className,
        //the methodName,and the path to the JAR
        //This should be called before doing any of the getter methods
        //=============================================================
        public void init() {
            try {
                XMLReader xmlreader = XMLReaderFactory.createXMLReader();
                SAXLoader handler = new SAXLoader();
                xmlreader.setContentHandler(handler);
                xmlreader.setErrorHandler(handler);
                try {
                    FileReader r = new FileReader("myclass.xml");
                    xmlreader.parse(new InputSource(r));
                } catch (FileNotFoundException e) {
                    System.out.println("File Not Found!");
                    e.printStackTrace();
                } catch (NullPointerException e) {
                    System.out.println("Parse Error!");
                    e.printStackTrace();
            } catch (Exception e) {
                System.out.println("XML Reader Error!");
                e.printStackTrace();
    public void characters(char ch[], int start, int length) {
            String temp = "";
            for (int i = start; i < start + length; i++) {
                switch (ch) {
    case '\\':
    // System.out.print("\\\\");
    break;
    case '"':
    // System.out.print("\\\"");
    break;
    case '\n':
    // System.out.print("\\n");
    break;
    case '\r':
    // System.out.print("\\r");
    break;
    case '\t':
    // System.out.print("\\t");
    break;
    default:
    temp += ch[i];
    break;
    if (isClassName) {
    className = temp;
    } else if (isMethodName) {
    methodName = temp;
    } else if (isPath) {
    path = temp;
    } else if (isParameter) {
    System.out.println("zomg!: " + temp);
    params.add(temp);
    } //end of characters(...
    Right there at params.add(temp);
    I'm using this DefaultHandler based class to parse an XML file for information regarding a user's own class [its classname, its methodname, and the methods parameters].
    Any clues?
    Message was edited by:
    nick.mancuso
    Message was edited by:
    nick.mancuso

    You don't actually allocate the params Vector, at least not on the code you've posted. You want something like:
    private Vector params = new Vector();or better yet:
    private List params = new LinkedList();perhaps.
    But even better yet...I suspect that having a handful of global temp variables like that isn't going to work. In my experience, when using SAX you pretty much have to create a stack to hold the current place in the XML tree. That's how you traverse trees, with stacks. Then instead of setting isMethodName, isParameter, etc. (which I presume you do in open/close tag handlers) you define an enumeration of values like "class", "method", "parameter", and then have a stack of those values, or something.

  • SAX Parser method charaters trouble

    Hi,
    I am using a sax parser for loading an xml file of size over 1gb. The problem whats happening is that the content gets truncated at random.
    And this truncation happens in the characters method of the sax parser. This am sure as I logged the content I get from characters method before starting my processing. for ex:
    <content>signal1,signal960</content>
    <content>signal1,signal970</content>
    On parsing the above snippet, the first content "signal1,signal960"
    gets extracted completely, however the next one is truncated, and the truncation is random. This happens for some tags, and then the extraction resumes normally. And this truncation starts occuring again after it has extracted a few tags.
    Also the first truncation started occuring only after parsing around 200 mb of the 1gb file.
    Could anyone tell if there is some limitation with XERCES or CRIMSON.
    or if any other one that I can use???
    Regards,
    R.

    To quote from the Documentation of ContentHandler.characters:
    -- start quote --
    The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information.
    -- end quote --
    So providing the content in two seperate calls is perfectly valid and must be handled by your code. It's probably a result of the internal workings of the XML parser and allowing that in the Parser specification probably allowed some optimizations that would otherwise be impossible (a constant buffer size, for example).

  • Problem with SAX characters method

    Well I already used SAX on couple occasions, and there was no problems. But this time I have weird situation. characters method from handler class (SAX parser) does not handle XML element at once, but in two passes. For example:
    <some>this is some text</some>is handled by calling characters method TWICE (e.g. 'this is' and 'some text'). Is this normal behavior, or I do not form XML file properly? If it is normal, can anyone tell me how to detect this behavior?
    Every help is appreciated. Cheers!
    Message was edited by:
    zly

    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPSAX3.html
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4316794
    http://forum.java.sun.com/thread.jspa?threadID=5130656&tstart=0

  • SAX error parsing by element. need help!

    I am trying to develop a small method to that can parse an xml file and return an elements value. I got some code to build a SAXHandler. I have build the SAXHandler and have compiled it no problem.
    import java.io.*;
    import java.util.Hashtable;
    import org.xml.sax.*;
    import org.xml.sax.helpers.*;
    public class SAXHandler extends DefaultHandler {
    private Hashtable table = new Hashtable();
    private String currentElement = null;
    private String currentValue = null;
    public void setTable(Hashtable table) {
    this.table = table;
    public Hashtable getTable(){
    return table;
    public void startElement(String tag, Attributes attrs)
    throws SAXException {
    currentElement = tag;
    public void characters(char[] ch, int start, int length)
    throws SAXException {
    currentValue = new String(ch, start, length);
    public void endElement(String name) throws SAXException {
    if (currentElement.equals(name)) {
    table.put(currentElement, currentValue);
    I am using the following code to read the file in and parse it.
    public String getXMLElement(){
    try {
    File xmlFile = new File(appDataFile);
    FileReader xmlRead = new FileReader(xmlFile);
    XMLReader xmlParser;
    SAXParserFactory spf = SAXParserFactory.newInstance();
    SAXParser sp = spf.newSAXParser();
    SAXHandler handler = new SAXHandler();
    sp.parse(new InputSource(xmlRead), handler);
    i am recieving the following error when I try to run the servlet
    javax.servlet.ServletException: Cannot allocate servlet instance for path /JDtrack/servlet/JDTrack
    what makes this wierd is that is i take out the line
    sp.parse(new InputSource(xmlRead), handler);
    I do not get the error.
    I am newer to java and could use all the help I can get
    thanks.

    A few things to try to help identify the problem:
    -Create and InputSource before parsing the file. If the InputSource cannot be created, there may be a problem with accessing the file from your servlet.
    -Write a quick program to do the same thing from an application. If you can do this outside the servlet container, it may be a problem from running inside the servlet container.
    -The code you listed is in a try block, however the catch block is not listed. If you are not already doing so, place debug message (to console or log) from inside each catch block. If an exception is thrown but not handled corrrectly, the servlet container may just throw a ServletException.
    Hope this helps.

Maybe you are looking for

  • How to make menu/list (form) item open in it's own window instead of blank one?

    Items in a form (list/menu) that I've created are opening in a blank window (pop-up) when clicked. I would like them to open in "self" mode so that pop up blockers on various computers don't become a challenge for site visitors. Can anyone please tel

  • Segmentation G/l a/c determentation

    Hai experts..., Can any one help me  about G/l a/c determentation screen when we switch to segmentation a/c? i know i do define Control a/c and i have one doubt wheather rawmaterial a/c we are using one in standard COA here based on segmentation it w

  • Changing .mac screen name

    I'd like to use iChat through my .mac account but don't want my name showing up with the @mac.com suffix. is there any way to change the screen name used by .mac, or do i have to go get an AIM user name and sign on with that?

  • Mail in Macbook, no content only headers

    Mail messages in one of my maps only show the headers, no content. This suddenly happened, what can I do? The other messages in other maps are ok. How can I get the content back? It is very important. Thanks, grtz. Marike

  • Soft Proofing - Thank you!

    I've had just a few minutes to play with the soft proffing tool that is now a part of the develop module and I must say that I am very impressed.  This appears to be a well thought-out addition to LR.  I particularly like the out-of-gamut warnings fo