سؤال

For parsing an xml response using TagSoup I am extending the DefaultHandler, now I have the problem that it ignores an attribute with a qualified name in the method;

public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException 

The element looks as follows;

<element xmlns:ns2="http://my.ns.url">{content}</element>

when it gets to the startElement method for this element, the atts parameter has no attributes in it. Does anyone know how to fix this without adjusting the xml?

Edit I tried using the setFeature method for the feature;

http://xml.org/sax/features/namespace-prefixes

But without any result

هل كانت مفيدة؟

المحلول

I fixed it by stopping to use TagSoup, and resolved to the standard Android SAXParser. Then I changed feature settings as follows;

setFeature("http://xml.org/sax/features/namespaces", false);    
setFeature("http://xml.org/sax/features/namespace-prefixes", true);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top