OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Problem parsing XML file with Xerces-J

[ Lists Home | Date Index | Thread Index ]

Hope this question is not off topic..

I have successfully written my program after solving the problem I
posted here. It achieves the result, but the performance is a bit
slow.

I need to enhance the performance..

Here is a brief outline of my work till now, shown as a pseudo code:

//infinite loop 
for(;;) {
   String rsp = //get XML from remote URL  ;
   
   //remove DTD reference
   rsp = rsp.substring(rsp.indexOf("<MESSAGING>"));

   //parse response XML (using DOM API)
   Document document = builder.parse(new InputSource(new StringReader(rsp)));
   NodeList nodeList = document.getElementsByTagName("XYZ"); //this is
a specific tag which I want to read. It occurs many time (between
100-500)

   //iterating the nodeList
   for(int i = 0; i < nodeList.getLength(); i++)
   {
      //extract something ;)  from current node
      //send a response to a remote URL      // (1): this establishes
a HTTP connection
   }

   //cause delay of 15 seconds - this is the pooling interval
   Thread.sleep(15*1000);
}

Thats my program basically..

If you observe, sending the response (marked 1) (after detecting the
instance of tag XYZ in the inner for loop) for n number of tags(
nodeList.getLength() ) happens sequentially. But the end users would
expect high response time (this is a real time application).

Can I improve processing by running parallel threads? If yes, should I
create 1 thread for 1 response. Or can I divide the nodeList into
equal parts (lets say nodeList.getLength() / 5) ). So that 1 thread
will handle 5 responses. i.e. groups of 5 nodes will be handled in
parallel. What trade off should I do..?

Any suggestions please?

best regards,

On Apr 1, 2005 9:57 PM, Rich Salz <rsalz@datapower.com> wrote:
> Have you tried asking Xerces questions on the xerces mailing lists?
> 
> See http://xml.apache.org/mail.html#xerces-j-user
> 
>        /r$
> 
> --
> Rich Salz, Chief Security Architect
> DataPower Technology                           http://www.datapower.com
> XS40 XML Security Gateway   http://www.datapower.com/products/xs40.html
>




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS