Results 1 to 8 of 8
  1. #1
    pads is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default Sax Parser Exception

    I am creating many xml files and used thread class to create all the pages simultaneously but I am getting sax parser exception, so that pages are not created with required data. I am adding sample code here.

    class PageThread extends Thread
    {
    Content content;

    public createPageThread(Content content)
    {
    this.content = content;
    }

    public void run()
    {
    createPage(content);
    }
    }

    This creatPage(Content) method has many methods.

    I think when more than one thread try to access the same method that time we will get this error but I am not sure, If this is the case then what is the point of using threads?

    Can anyone help me to solve this issue...

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default

    but I am getting sax parser exception
    Can you post the full content of the error message here?

  3. #3
    pads is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Can you post the full content of the error message here?
    Hi,

    Thanks for ur reply, this the full error msg,

    org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
    at com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBu ilderImpl.parse(Unknown Source)
    at com.sun.org.apache.xpath.internal.jaxp.XPathExpres sionImpl.evaluate(Unknown Source)
    at com.adobe.idml.XmlUtils.getXPathValue(XmlUtils.jav a:170)
    at com.adobe.idml.XmlUtils.getAttributes(XmlUtils.jav a:286)
    at elements.shared.CharacterStyleRange.getAllSubEleme nts(CharacterStyleRange.java:3363)
    at sample.MMLCreator.textFrameContent(MMLCreator.java :3259)
    at sample.MMLCreator.createPage(MMLCreator.java:1571)
    at sample.MMLCreator.access$0(MMLCreator.java:133)
    at sample.MMLCreator$createPageThread.run(MMLCreator. java:130)

    javax.xml.xpath.XPathExpressionException
    at com.sun.org.apache.xpath.internal.jaxp.XPathExpres sionImpl.evaluate(Unknown Source)
    at com.adobe.idml.XmlUtils.getXPathValue(XmlUtils.jav a:170)
    at com.adobe.idml.XmlUtils.getAttributes(XmlUtils.jav a:286)
    at elements.shared.CharacterStyleRange.getAllSubEleme nts(CharacterStyleRange.java:3363)
    at sample.MMLCreator.textFrameContent(MMLCreator.java :3259)
    at sample.MMLCreator.createPage(MMLCreator.java:1571)
    at sample.MMLCreator.access$0(MMLCreator.java:133)
    at sample.MMLCreator$createPageThread.run(MMLCreator. java:130)
    Caused by: org.xml.sax.SAXException: FWK005 parse may not be called while parsing.
    at com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBu ilderImpl.parse(Unknown Source)
    ... 8 more

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default

    Is the parse method thread safe? Ie can it be called from separate threads at the same time.

  5. #5
    pads is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Is the parse method thread safe? Ie can it be called from separate threads at the same time.
    I am using DoucmentBuilder.parse() only, Is it thread safe? Can u pls tel me how to find that a method is thread safe?
    Last edited by pads; 06-21-2010 at 03:50 PM.

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,556
    Rep Power
    23

    Default

    com.sun.org.apache.xerces.internal.parsers.DOMPars er.parse
    This appears to be the call that triggers the error.
    I have no idea how those methods and classes connect.
    How does your code use them? Does each thread have its own objects for parsing or do they share?

  7. #7
    pads is offline Member
    Join Date
    Jun 2010
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    This appears to be the call that triggers the error.
    I have no idea how those methods and classes connect.
    How does your code use them? Does each thread have its own objects for parsing or do they share?
    Yes, each thread has its own object.

  8. #8
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    4

    Default

    Just out of curiosity, why do all of this in different threads?

Similar Threads

  1. Parser API
    By sruti_mohan in forum Advanced Java
    Replies: 0
    Last Post: 06-09-2008, 07:23 AM
  2. DNS name parser 1.2.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-14-2007, 08:21 PM
  3. XML Parser
    By samfuerte in forum XML
    Replies: 1
    Last Post: 07-14-2007, 04:14 PM
  4. Parser
    By Peter in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 07:08 AM
  5. Dom Parser
    By Marcus in forum Advanced Java
    Replies: 2
    Last Post: 07-02-2007, 06:47 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •