[Home] [By Thread] [By Date] [Recent Entries]

  • To: Rich Salz <rsalz@d...>
  • Subject: Re: Problem parsing XML file with Xerces-J
  • From: Midsummer Sun <midsummer.sun@g...>
  • Date: Mon, 4 Apr 2005 14:30:06 +0530
  • Cc: xml-dev@l...
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=EekqSkZJIrFtxVzpnQ5zAR/yfNgzH+qp/5iXbLh1Ab/7geTmY86iGN0l6eFI0VJ2+bTT1dqOhl/G0iBPUXXstG5glxUmRFJzi/ld0EFpeSLWZbU5jUG/KRw6BL7L9UNlrdGbEbkgfOEcQtzTrn5IZCTBlqDkDCgFdJvBcN6qx14=
  • In-reply-to: <424D7673.4050701@d...>
  • References: <bb5e8b86050331053731edca96@m...> <424c03c3.421dc0eb.67bd.ffffb62bSMTPIN_ADDED@m...> <bb5e8b8605033120201ef8eb03@m...> <bb5e8b86050331203837ef2080@m...> <cc159a4a05040106424ed51393@m...> <bb5e8b860504010812179ae4a9@m...> <424D7673.4050701@d...>
  • Reply-to: Midsummer Sun <midsummer.sun@g...>

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@d...> 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
>

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member