Help: Attributes has content but getLengh always retures zero

Hi

I am using SAX parser to read an xml and do sth with it.

in the startElement method

public void startElement(final String uri, final String localName,

final String qName, final Attributes attributes)

throws SAXException {

if qName equals somevalue

then I will copy attributes

Although in eclipse debugger it shows that attributes has one attribute, but when using attributes.getLength it always returns 0

AttributesImpl attr = new AttributesImpl(attributes);

gives me an empty attr.

Any suggustions? Thanks a lot.

[595 byte] By [sunAccounta] at [2007-11-26 15:18:07]
# 1

Hi I found out why.

The list will not contain attributes that were declared #IMPLIED but not specified in the start tag. It will also not contain attributes used as Namespace declarations (xmlns*) unless the http://xml.org/sax/features/namespace-prefixes feature is set to true (it is false by default).

sunAccounta at 2007-7-8 11:00:24 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...