简体   繁体   中英

TagSoup attributes with namespace prefix

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM