Hello,

I have the following problem with the Saxparser (xercesImpl.jar , 
xmlParserAPIs.jar) in the following code snippet:



in a tag named proxyhost I am expecting the string "proxy.vz.ba.de"  but i get 
the string "pr" and then "oxy.vz.ba.de"

It seems that the call back methode below ( characters() ) is called more than 
once when the parser encounters the "proxyhost"  tag. 

public void  characters(char[] ch, int start, int length)

{
        
         if (currentTag=="proxyhost")
         {

                  System.out.println("SCHEMALOCATION");
                String s= (new String(ch,start,length)).trim();
                if(s.length()>0)
                        {
                config.setProxyhost(s);   // confgig is a container object
                }
                
    }


}// methode end

I tried to solve the problem as follow, but this is not a good idea . has some 
one any better solution?

public void  characters(char[] ch, int start, int length)

{
        
         if (currentTag=="proxyhost")
         {

                String s= (new String(ch,start,length)).trim();
                 if(s.length()>0)

                 {
                        String temp=config.getProxyhost();   // confgig is a 
container object
                if(temp!=null) config.setProxyhost(temp + s);
                        else config.setProxyhost(s);
                        }


    }


}// methode end



Thanks for any help

Mohammed


Reply via email to