Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

In my startElement handler, Im trying to store the Attributes/AttributeList, but Im getting weird results. Whats going on?

0
Posted

In my startElement handler, Im trying to store the Attributes/AttributeList, but Im getting weird results. Whats going on?

0

You probably have a handler like this: public void startElement (String name, AttributeList attrs) throws SAXException { my_attr = attrs; } The problem is the SAX framework, in order to be as efficient as possible, will reuse that attrs object which you have a reference to. In order to get around this problem you need to make a persistant copy of the AttributeList or Attributes object. Look in the docs at the AttributesImpl and AttributeListImpl classes to see how to do this. Back to top…

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123